mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-07 00:17:37 +08:00
fix: unittest for python2.7
This commit is contained in:
+1
-1
@@ -197,7 +197,7 @@ class HttpRunner(object):
|
|||||||
parsed_testcases = parser.parse_tests(tests_mapping)
|
parsed_testcases = parser.parse_tests(tests_mapping)
|
||||||
parse_failed_testfiles = parser.get_parse_failed_testfiles()
|
parse_failed_testfiles = parser.get_parse_failed_testfiles()
|
||||||
if 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")
|
utils.dump_logs(parse_failed_testfiles, project_mapping, "parse_failed")
|
||||||
|
|
||||||
if self.save_tests:
|
if self.save_tests:
|
||||||
|
|||||||
+4
-3
@@ -571,6 +571,10 @@ def dump_json_file(json_data, json_file_abs_path):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
return str(obj)
|
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:
|
try:
|
||||||
with io.open(json_file_abs_path, 'w', encoding='utf-8') as outfile:
|
with io.open(json_file_abs_path, 'w', encoding='utf-8') as outfile:
|
||||||
if is_py2:
|
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)
|
test_file_name, _file_suffix = os.path.splitext(test_file)
|
||||||
dump_file_name = "{}.{}.json".format(test_file_name, tag_name)
|
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)
|
dumped_json_file_abs_path = os.path.join(file_foder_path, dump_file_name)
|
||||||
return dumped_json_file_abs_path
|
return dumped_json_file_abs_path
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user