summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangchengwei <[email protected]>2022-10-26 16:58:01 +0800
committerzhangchengwei <[email protected]>2022-10-26 16:58:01 +0800
commit0bc106e9605b1c60632d3a0eb50f79d89ba188ad (patch)
tree98dc62933700b5d69c878211aa11b36e2c8729e6
parent95c9ea84a73f9527fcc1fc237714f9814a7c0f37 (diff)
修复用例执行停止问题,线程锁方法更改
-rw-r--r--control/business.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/control/business.py b/control/business.py
index 022ed84..2344f7b 100644
--- a/control/business.py
+++ b/control/business.py
@@ -451,20 +451,33 @@ def execute_commond_of_robot(robot_command, f_dict, tsglogger):
if int(failed_to_re_execute_count) > 0:
repetitive_execution_count = int(failed_to_re_execute_count)
else:
- repetitive_execution_count = 0
+ repetitive_execution_count = 1
for i in range(1 + repetitive_execution_count):
execute_dryrun_command = subprocess.Popen(robot_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
dryrun_command_result = str(execute_dryrun_command.stdout.read().decode(encoding="utf-8",errors="ignore"))
tsglogger.info(dryrun_command_result)
- dryrun_command_result = re.search("-----------------------------------------------------------------.*", dryrun_command_result, flags=re.DOTALL).group(0)
+
+ try:
+ dryrun_command_result = re.search("-----------------------------------------------------------------.*", dryrun_command_result, flags=re.DOTALL).group(0)
+ except:
+ tsglogger.info("dryrun_command_result的数据没有找到符合的 -----------------------------------------------------------------.* 关系")
+ tsglogger.debug(f"dryrun_command_result的变量值:{dryrun_command_result}")
+
if "PASS" in dryrun_command_result:
+ tsglogger.info("用例执行成功...")
break
else: #没有获取到case通过的pass标志时,判断为case执行失败,将失败的robot_comand命令暂时留存起来,执行一轮后再次执行失败的用例
exec_fail_lock.acquire()
exec_fail_robot_command_list.append(robot_command)
- exec_fail_lock.acquire()
+ exec_fail_lock.release()
tsglogger.info(f"执行失败的命令:{robot_command}")
- report_path = re.search("Report:.*", dryrun_command_result).group(0)
+
+ try:
+ report_path = re.search("Report:.*", dryrun_command_result).group(0)
+ except:
+ tsglogger.info("dryrun_command_result的数据没有找到符合的 Report:.* 关系")
+ tsglogger.debug(f"dryrun_command_result的变量值:{dryrun_command_result}")
+ exit(1)
str1 = re.search("cd\s.*?\s", robot_command).group(0).split() #重新从执行命令中拼出casename,其它的地方不好改变了
str2 = re.search("--test.*", robot_command).group(0).split()
#case_name = str1[1] + str2[-1].rstrip(".robot") + "/" + str2[1]