mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-31 05:19:38 +08:00
fix #343: locate debugtalk.py and use as project working directory
This commit is contained in:
@@ -36,22 +36,6 @@ class HttpRunner(object):
|
||||
self.kwargs = kwargs
|
||||
self.http_client_session = self.kwargs.pop("http_client_session", None)
|
||||
|
||||
self.__loader()
|
||||
|
||||
def __loader(self):
|
||||
""" load project dependent files, including api/testcase definitions,
|
||||
environment variables and builtin module.
|
||||
|
||||
"""
|
||||
loader.reset_loader()
|
||||
|
||||
# load api/testcase definition and debugtalk.py module
|
||||
project_folder_path = os.path.join(os.getcwd(), "tests") # TODO: remove tests
|
||||
loader.load_project_tests(project_folder_path)
|
||||
|
||||
self.project_mapping = loader.project_mapping
|
||||
utils.set_os_environ(self.project_mapping["env"])
|
||||
|
||||
def load_tests(self, path_or_testcases):
|
||||
""" load testcases, extend and merge with api/testcase definitions.
|
||||
|
||||
@@ -94,14 +78,14 @@ class HttpRunner(object):
|
||||
if isinstance(path_or_testcases, list):
|
||||
for testcase in path_or_testcases:
|
||||
try:
|
||||
dir_path = os.path.dirname(testcase["config"]["path"])
|
||||
loader.load_debugtalk_module(dir_path)
|
||||
test_path = os.path.dirname(testcase["config"]["path"])
|
||||
loader.load_project_tests(test_path)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
dir_path = os.path.dirname(path_or_testcases["config"]["path"])
|
||||
loader.load_debugtalk_module(dir_path)
|
||||
test_path = os.path.dirname(path_or_testcases["config"]["path"])
|
||||
loader.load_project_tests(test_path)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
@@ -109,6 +93,8 @@ class HttpRunner(object):
|
||||
else:
|
||||
testcases = loader.load_testcases(path_or_testcases)
|
||||
|
||||
self.project_mapping = loader.project_mapping
|
||||
|
||||
if not testcases:
|
||||
raise exceptions.TestcaseNotFound
|
||||
|
||||
@@ -245,8 +231,9 @@ class HttpRunner(object):
|
||||
instance: HttpRunner() instance
|
||||
|
||||
"""
|
||||
# parser
|
||||
# loader
|
||||
testcases_list = self.load_tests(path_or_testcases)
|
||||
# parser
|
||||
parsed_testcases_list = self.parse_tests(testcases_list)
|
||||
|
||||
# initialize
|
||||
|
||||
Reference in New Issue
Block a user