diff --git a/httprunner/api.py b/httprunner/api.py index 05ba66b2..cbb7fc0f 100644 --- a/httprunner/api.py +++ b/httprunner/api.py @@ -197,7 +197,7 @@ class HttpRunner(object): parsed_testcases = parser.parse_tests(tests_mapping) parse_failed_testfiles = parser.get_parse_failed_testfiles() if parse_failed_testfiles: - logger.log_warning("There are some test files that can not be parsed ...") + logger.log_warning("parse failures occurred ...") utils.dump_logs(parse_failed_testfiles, project_mapping, "parse_failed") if self.save_tests: diff --git a/httprunner/utils.py b/httprunner/utils.py index 5124290d..67b972e8 100644 --- a/httprunner/utils.py +++ b/httprunner/utils.py @@ -571,6 +571,10 @@ def dump_json_file(json_data, json_file_abs_path): except TypeError: return str(obj) + file_foder_path = os.path.dirname(json_file_abs_path) + if not os.path.isdir(file_foder_path): + os.makedirs(file_foder_path) + try: with io.open(json_file_abs_path, 'w', encoding='utf-8') as outfile: if is_py2: @@ -627,9 +631,6 @@ def prepare_dump_json_file_abs_path(project_mapping, tag_name): test_file_name, _file_suffix = os.path.splitext(test_file) dump_file_name = "{}.{}.json".format(test_file_name, tag_name) - if not os.path.isdir(file_foder_path): - os.makedirs(file_foder_path) - dumped_json_file_abs_path = os.path.join(file_foder_path, dump_file_name) return dumped_json_file_abs_path