mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
fix os sep: make compatible with Windows/Linux
This commit is contained in:
@@ -300,7 +300,8 @@ def __extend_with_api_ref(raw_testinfo):
|
|||||||
# 1, individual file: each file is corresponding to one api definition
|
# 1, individual file: each file is corresponding to one api definition
|
||||||
# 2, api sets file: one file contains a list of api definitions
|
# 2, api sets file: one file contains a list of api definitions
|
||||||
if not os.path.isabs(api_name):
|
if not os.path.isabs(api_name):
|
||||||
api_path = os.path.join(tests_def_mapping["PWD"], api_name)
|
# make compatible with Windows/Linux
|
||||||
|
api_path = os.path.join(tests_def_mapping["PWD"], *api_name.split("/"))
|
||||||
if os.path.isfile(api_path):
|
if os.path.isfile(api_path):
|
||||||
# type 1: api is defined in individual file
|
# type 1: api is defined in individual file
|
||||||
api_name = api_path
|
api_name = api_path
|
||||||
@@ -319,9 +320,10 @@ def __extend_with_testcase_ref(raw_testinfo):
|
|||||||
testcase_path = raw_testinfo["testcase"]
|
testcase_path = raw_testinfo["testcase"]
|
||||||
|
|
||||||
if testcase_path not in tests_def_mapping["testcases"]:
|
if testcase_path not in tests_def_mapping["testcases"]:
|
||||||
|
# make compatible with Windows/Linux
|
||||||
testcase_path = os.path.join(
|
testcase_path = os.path.join(
|
||||||
project_mapping["PWD"],
|
project_mapping["PWD"],
|
||||||
testcase_path
|
*testcase_path.split("/")
|
||||||
)
|
)
|
||||||
testcase_dict = load_testcase(load_file(testcase_path))
|
testcase_dict = load_testcase(load_file(testcase_path))
|
||||||
tests_def_mapping[testcase_path] = testcase_dict
|
tests_def_mapping[testcase_path] = testcase_dict
|
||||||
|
|||||||
Reference in New Issue
Block a user