fix generated log filename when testing folder with '/' ending

This commit is contained in:
httprunner
2018-11-26 11:23:48 +08:00
parent a647bc05a8
commit 4c08f58e3c
+5 -5
View File
@@ -415,13 +415,13 @@ def get_testcase_io(testcase):
dict: input(variables) and output mapping. dict: input(variables) and output mapping.
""" """
runner = testcase.runner test_runner = testcase.runner
variables = testcase.config.get("variables", []) variables = testcase.config.get("variables", {})
output_list = testcase.config.get("output", []) output_list = testcase.config.get("output", [])
return { return {
"in": dict(variables), "in": variables,
"out": runner.extract_output(output_list) "out": test_runner.extract_output(output_list)
} }
@@ -625,7 +625,7 @@ def _prepare_dump_info(project_mapping, tag_name):
""" """
test_path = project_mapping.get("test_path") or "tests_mapping" test_path = project_mapping.get("test_path") or "tests_mapping"
pwd_dir_path = project_mapping.get("PWD") or os.getcwd() pwd_dir_path = project_mapping.get("PWD") or os.getcwd()
file_name, file_suffix = os.path.splitext(os.path.basename(test_path)) file_name, file_suffix = os.path.splitext(os.path.basename(test_path.rstrip("/")))
dump_file_name = "{}.{}.json".format(file_name, tag_name) dump_file_name = "{}.{}.json".format(file_name, tag_name)
return pwd_dir_path, dump_file_name return pwd_dir_path, dump_file_name