diff options
| author | 李玺康 <[email protected]> | 2022-05-11 10:30:48 +0800 |
|---|---|---|
| committer | 李玺康 <[email protected]> | 2022-05-11 10:30:48 +0800 |
| commit | 6b95a44c173192a51e73039ed0b388ae99edb1f6 (patch) | |
| tree | cd685874b765cd470b26a477433a983fdc79b9c5 | |
| parent | 2c23d413744189aca20104a99d017bb2a1a42f16 (diff) | |
更改robot提取结果代码逻辑
| -rw-r--r-- | control/business.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/control/business.py b/control/business.py index f6dffda..459f282 100644 --- a/control/business.py +++ b/control/business.py @@ -256,8 +256,9 @@ def execute_commond_of_robot(robot_command, f_dict, tsglogger): repetitive_execution_count = 0 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()) + 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) if "PASS" in dryrun_command_result: break report_path = re.search("Report:.*", dryrun_command_result).group(0) @@ -278,7 +279,10 @@ def execute_commond_of_robot(robot_command, f_dict, tsglogger): return {"case":case_name, "status":1} else: #只执行dryrun命令 execute_dryrun_command = subprocess.Popen(robot_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - dryrun_command_result = str(execute_dryrun_command.stdout.readlines()) + dryrun_command_result_list = execute_dryrun_command.stdout.readlines() + dryrun_command_result_list1 = [i.decode(encoding="utf-8",errors="ignore") for i in dryrun_command_result_list] + dryrun_command_result = "".join(dryrun_command_result_list1) + tsglogger.info(dryrun_command_result) #获取output输出文件绝对路径,通过正则方式从命令中取出文件路径 a = re.search("-d\s(.*?)\s", robot_command).group().lstrip("-d ").rstrip(" ") |
