mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix #808: project_working_directory is not initialized when running passed in data structure
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
- fix #826: Windows does not support file name include ":"
|
||||
- fix #819: maximum recursion error in locusts
|
||||
- fix #818: request missed url in setup_hooks
|
||||
- fix #808: project_working_directory is not initialized when running passed in data structure
|
||||
|
||||
## 2.5.1 (2020-01-02)
|
||||
|
||||
|
||||
@@ -292,6 +292,8 @@ class HttpRunner(object):
|
||||
if loader.is_test_path(path_or_tests):
|
||||
return self.run_path(path_or_tests, dot_env_path, mapping)
|
||||
elif loader.is_test_content(path_or_tests):
|
||||
project_working_directory = path_or_tests.get("project_mapping", {}).get("PWD", os.getcwd())
|
||||
loader.init_pwd(project_working_directory)
|
||||
return self.run_tests(path_or_tests)
|
||||
else:
|
||||
raise exceptions.ParamsError("Invalid testcase path or testcases: {}".format(path_or_tests))
|
||||
|
||||
@@ -9,7 +9,8 @@ HttpRunner loader
|
||||
"""
|
||||
|
||||
from httprunner.loader.check import is_test_path, is_test_content, JsonSchemaChecker
|
||||
from httprunner.loader.locate import get_project_working_directory as get_pwd
|
||||
from httprunner.loader.locate import get_project_working_directory as get_pwd, \
|
||||
init_project_working_directory as init_pwd
|
||||
from httprunner.loader.load import load_csv_file, load_builtin_functions
|
||||
from httprunner.loader.buildup import load_cases, load_project_data
|
||||
|
||||
@@ -18,6 +19,7 @@ __all__ = [
|
||||
"is_test_content",
|
||||
"JsonSchemaChecker",
|
||||
"get_pwd",
|
||||
"init_pwd",
|
||||
"load_csv_file",
|
||||
"load_builtin_functions",
|
||||
"load_project_data",
|
||||
|
||||
@@ -62,7 +62,11 @@ def locate_debugtalk_py(start_path):
|
||||
|
||||
def init_project_working_directory(test_path):
|
||||
""" this should be called at startup
|
||||
init_project_working_directory <- load_project_data <- load_cases <- run
|
||||
|
||||
run test file:
|
||||
run_path -> load_cases -> load_project_data -> init_project_working_directory
|
||||
or run passed in data structure:
|
||||
run -> init_project_working_directory
|
||||
|
||||
Args:
|
||||
test_path: specified testfile path
|
||||
|
||||
Reference in New Issue
Block a user