mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
refactor: rename project_mapping to project_meta
This commit is contained in:
@@ -207,7 +207,7 @@ class HttpRunner(object):
|
||||
def run_tests(self, tests_mapping):
|
||||
""" run testcase/testsuite data
|
||||
"""
|
||||
self.test_path = tests_mapping.get("project_mapping", {}).get("test_path", "")
|
||||
self.test_path = tests_mapping.get("project_meta", {}).get("test_path", "")
|
||||
|
||||
if self.save_tests:
|
||||
utils.dump_json_file(
|
||||
@@ -312,7 +312,7 @@ class HttpRunner(object):
|
||||
tests_mapping = loader.load_cases(path, dot_env_path)
|
||||
|
||||
if mapping:
|
||||
tests_mapping["project_mapping"]["variables"] = mapping
|
||||
tests_mapping["project_meta"]["variables"] = mapping
|
||||
|
||||
return self.run_tests(tests_mapping)
|
||||
|
||||
@@ -334,7 +334,7 @@ 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())
|
||||
project_working_directory = path_or_tests.get("project_meta", {}).get("PWD", os.getcwd())
|
||||
loader.init_pwd(project_working_directory)
|
||||
return self.run_tests(path_or_tests)
|
||||
else:
|
||||
|
||||
@@ -28,7 +28,7 @@ async def debug_single_testcase(project_meta: ProjectMeta, testcase: TestCase):
|
||||
|
||||
testcase_json = testcase.dict(by_alias=True)
|
||||
tests_mapping = {
|
||||
"project_mapping": project_meta_json,
|
||||
"project_meta": project_meta_json,
|
||||
"testcases": [testcase_json]
|
||||
}
|
||||
|
||||
@@ -59,6 +59,6 @@ async def debug_single_testcase(project_meta: ProjectMeta, testcase: TestCase):
|
||||
# @router.post("/hrun/debug/testcases", tags=["debug"])
|
||||
# async def debug_multiple_testcases(project_meta: ProjectMeta, testcases: TestCases):
|
||||
# tests_mapping = {
|
||||
# "project_mapping": project_meta,
|
||||
# "project_meta": project_meta,
|
||||
# "testcases": testcases
|
||||
# }
|
||||
|
||||
@@ -59,7 +59,7 @@ def __extend_with_api_ref(raw_testinfo):
|
||||
else:
|
||||
block = load_file(api_name)
|
||||
|
||||
# NOTICE: avoid project_mapping been changed during iteration.
|
||||
# NOTICE: avoid project_meta been changed during iteration.
|
||||
raw_testinfo["api_def"] = utils.deepcopy_dict(block)
|
||||
tests_def_mapping["api"][api_name] = block
|
||||
|
||||
@@ -311,14 +311,14 @@ def load_project_data(test_path, dot_env_path=None):
|
||||
"""
|
||||
debugtalk_path, project_working_directory = init_project_working_directory(test_path)
|
||||
|
||||
project_mapping = {}
|
||||
project_meta = {}
|
||||
|
||||
# load .env file
|
||||
# NOTICE:
|
||||
# environment variable maybe loaded in debugtalk.py
|
||||
# thus .env file should be loaded before loading debugtalk.py
|
||||
dot_env_path = dot_env_path or os.path.join(project_working_directory, ".env")
|
||||
project_mapping["env"] = load_dot_env_file(dot_env_path)
|
||||
project_meta["env"] = load_dot_env_file(dot_env_path)
|
||||
|
||||
if debugtalk_path:
|
||||
# load debugtalk.py functions
|
||||
@@ -327,11 +327,11 @@ def load_project_data(test_path, dot_env_path=None):
|
||||
debugtalk_functions = {}
|
||||
|
||||
# locate PWD and load debugtalk.py functions
|
||||
project_mapping["PWD"] = project_working_directory
|
||||
project_mapping["functions"] = debugtalk_functions
|
||||
project_mapping["test_path"] = os.path.abspath(test_path)[len(project_working_directory) + 1:]
|
||||
project_meta["PWD"] = project_working_directory
|
||||
project_meta["functions"] = debugtalk_functions
|
||||
project_meta["test_path"] = os.path.abspath(test_path)[len(project_working_directory) + 1:]
|
||||
|
||||
return project_mapping
|
||||
return project_meta
|
||||
|
||||
|
||||
def load_cases(path: str, dot_env_path: str = None):
|
||||
@@ -345,10 +345,10 @@ def load_cases(path: str, dot_env_path: str = None):
|
||||
dot_env_path (str): specified .env file path
|
||||
|
||||
Returns:
|
||||
dict: tests mapping, include project_mapping and testcases.
|
||||
dict: tests mapping, include project_meta and testcases.
|
||||
each testcase is corresponding to a file.
|
||||
{
|
||||
"project_mapping": {
|
||||
"project_meta": {
|
||||
"PWD": "XXXXX",
|
||||
"functions": {},
|
||||
"env": {}
|
||||
@@ -389,7 +389,7 @@ def load_cases(path: str, dot_env_path: str = None):
|
||||
"""
|
||||
|
||||
tests_mapping = {
|
||||
"project_mapping": load_project_data(path, dot_env_path)
|
||||
"project_meta": load_project_data(path, dot_env_path)
|
||||
}
|
||||
|
||||
def __load_file_content(path):
|
||||
|
||||
@@ -14,38 +14,38 @@ class TestModuleLoader(unittest.TestCase):
|
||||
self.assertNotIn("is_py3", module_functions)
|
||||
|
||||
def test_load_debugtalk_module(self):
|
||||
project_mapping = buildup.load_project_data(os.path.join(os.getcwd(), "httprunner"))
|
||||
self.assertNotIn("alter_response", project_mapping["functions"])
|
||||
project_meta = buildup.load_project_data(os.path.join(os.getcwd(), "httprunner"))
|
||||
self.assertNotIn("alter_response", project_meta["functions"])
|
||||
|
||||
project_mapping = buildup.load_project_data(os.path.join(os.getcwd(), "tests"))
|
||||
self.assertIn("alter_response", project_mapping["functions"])
|
||||
project_meta = buildup.load_project_data(os.path.join(os.getcwd(), "tests"))
|
||||
self.assertIn("alter_response", project_meta["functions"])
|
||||
|
||||
is_status_code_200 = project_mapping["functions"]["is_status_code_200"]
|
||||
is_status_code_200 = project_meta["functions"]["is_status_code_200"]
|
||||
self.assertTrue(is_status_code_200(200))
|
||||
self.assertFalse(is_status_code_200(500))
|
||||
|
||||
def test_load_debugtalk_py(self):
|
||||
project_mapping = buildup.load_project_data("tests/data/demo_testcase.yml")
|
||||
project_working_directory = project_mapping["PWD"]
|
||||
debugtalk_functions = project_mapping["functions"]
|
||||
project_meta = buildup.load_project_data("tests/data/demo_testcase.yml")
|
||||
project_working_directory = project_meta["PWD"]
|
||||
debugtalk_functions = project_meta["functions"]
|
||||
self.assertEqual(
|
||||
project_working_directory,
|
||||
os.path.join(os.getcwd(), "tests")
|
||||
)
|
||||
self.assertIn("gen_md5", debugtalk_functions)
|
||||
|
||||
project_mapping = buildup.load_project_data("tests/base.py")
|
||||
project_working_directory = project_mapping["PWD"]
|
||||
debugtalk_functions = project_mapping["functions"]
|
||||
project_meta = buildup.load_project_data("tests/base.py")
|
||||
project_working_directory = project_meta["PWD"]
|
||||
debugtalk_functions = project_meta["functions"]
|
||||
self.assertEqual(
|
||||
project_working_directory,
|
||||
os.path.join(os.getcwd(), "tests")
|
||||
)
|
||||
self.assertIn("gen_md5", debugtalk_functions)
|
||||
|
||||
project_mapping = buildup.load_project_data("httprunner/__init__.py")
|
||||
project_working_directory = project_mapping["PWD"]
|
||||
debugtalk_functions = project_mapping["functions"]
|
||||
project_meta = buildup.load_project_data("httprunner/__init__.py")
|
||||
project_working_directory = project_meta["PWD"]
|
||||
debugtalk_functions = project_meta["functions"]
|
||||
self.assertEqual(
|
||||
project_working_directory,
|
||||
os.getcwd()
|
||||
@@ -57,7 +57,7 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.project_mapping = buildup.load_project_data(os.path.join(os.getcwd(), "tests"))
|
||||
cls.project_meta = buildup.load_project_data(os.path.join(os.getcwd(), "tests"))
|
||||
cls.tests_def_mapping = buildup.tests_def_mapping
|
||||
|
||||
def test_load_teststep_api(self):
|
||||
@@ -135,7 +135,7 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
path = os.path.join(
|
||||
os.getcwd(), 'tests/api/create_user.yml')
|
||||
tests_mapping = loader.load_cases(path)
|
||||
project_mapping = tests_mapping["project_mapping"]
|
||||
project_meta = tests_mapping["project_meta"]
|
||||
api_list = tests_mapping["apis"]
|
||||
self.assertEqual(len(api_list), 1)
|
||||
self.assertEqual(api_list[0]["request"]["url"], "/api/users/$uid")
|
||||
@@ -149,7 +149,7 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
self.assertEqual(testcases[0]["config"]["name"], '123t$var_a')
|
||||
self.assertIn(
|
||||
"sum_two",
|
||||
tests_mapping["project_mapping"]["functions"]
|
||||
tests_mapping["project_meta"]["functions"]
|
||||
)
|
||||
self.assertEqual(
|
||||
testcases[0]["config"]["variables"]["var_c"],
|
||||
@@ -164,10 +164,10 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
path = os.path.join(
|
||||
os.getcwd(), 'tests/data/demo_testcase_layer.yml')
|
||||
tests_mapping = loader.load_cases(path)
|
||||
project_mapping = tests_mapping["project_mapping"]
|
||||
project_meta = tests_mapping["project_meta"]
|
||||
testcases_list = tests_mapping["testcases"]
|
||||
self.assertIn('device_sn', testcases_list[0]["config"]["variables"])
|
||||
self.assertIn("gen_md5", project_mapping["functions"])
|
||||
self.assertIn("gen_md5", project_meta["functions"])
|
||||
self.assertIn("base_url", testcases_list[0]["config"])
|
||||
test_dict0 = testcases_list[0]["teststeps"][0]
|
||||
self.assertEqual(
|
||||
@@ -184,7 +184,7 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
path = os.path.join(
|
||||
os.getcwd(), 'tests/testsuites/create_users.yml')
|
||||
tests_mapping = loader.load_cases(path)
|
||||
project_mapping = tests_mapping["project_mapping"]
|
||||
project_meta = tests_mapping["project_meta"]
|
||||
testsuites_list = tests_mapping["testsuites"]
|
||||
|
||||
self.assertEqual(
|
||||
@@ -231,13 +231,13 @@ class TestSuiteLoader(unittest.TestCase):
|
||||
|
||||
def test_load_project_tests(self):
|
||||
buildup.load_project_data(os.path.join(os.getcwd(), "tests"))
|
||||
self.assertIn("gen_md5", self.project_mapping["functions"])
|
||||
self.assertEqual(self.project_mapping["env"]["PROJECT_KEY"], "ABCDEFGH")
|
||||
self.assertIn("gen_md5", self.project_meta["functions"])
|
||||
self.assertEqual(self.project_meta["env"]["PROJECT_KEY"], "ABCDEFGH")
|
||||
self.assertEqual(
|
||||
os.path.basename(self.project_mapping["PWD"]),
|
||||
os.path.basename(self.project_meta["PWD"]),
|
||||
"tests"
|
||||
)
|
||||
self.assertEqual(
|
||||
os.path.basename(self.project_mapping["test_path"]),
|
||||
os.path.basename(self.project_meta["test_path"]),
|
||||
"tests"
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ class TestLoaderCheck(unittest.TestCase):
|
||||
self.assertFalse(check.is_test_content(data_structure))
|
||||
|
||||
data_structure = {
|
||||
"project_mapping": {
|
||||
"project_meta": {
|
||||
"PWD": "XXXXX",
|
||||
"functions": {},
|
||||
"env": {}
|
||||
|
||||
@@ -1047,14 +1047,14 @@ def _extend_with_testcase(test_dict, testcase_def_dict):
|
||||
test_dict.update(testcase_def_dict)
|
||||
|
||||
|
||||
def __prepare_config(config, project_mapping, session_variables_set=None):
|
||||
def __prepare_config(config, project_meta, session_variables_set=None):
|
||||
""" parse testcase/testsuite config.
|
||||
"""
|
||||
# get config variables
|
||||
raw_config_variables = config.pop("variables", {})
|
||||
|
||||
override_variables = utils.deepcopy_dict(project_mapping.get("variables", {}))
|
||||
functions = project_mapping.get("functions", {})
|
||||
override_variables = utils.deepcopy_dict(project_meta.get("variables", {}))
|
||||
functions = project_meta.get("functions", {})
|
||||
|
||||
if isinstance(raw_config_variables, str) and function_regex_compile.match(
|
||||
raw_config_variables):
|
||||
@@ -1091,7 +1091,7 @@ def __prepare_config(config, project_mapping, session_variables_set=None):
|
||||
return prepared_config
|
||||
|
||||
|
||||
def __prepare_testcase_tests(tests, config, project_mapping, session_variables_set=None):
|
||||
def __prepare_testcase_tests(tests, config, project_meta, session_variables_set=None):
|
||||
""" override tests with testcase config variables, base_url and verify.
|
||||
test maybe nested testcase.
|
||||
|
||||
@@ -1107,13 +1107,13 @@ def __prepare_testcase_tests(tests, config, project_mapping, session_variables_s
|
||||
Args:
|
||||
tests (list):
|
||||
config (dict):
|
||||
project_mapping (dict):
|
||||
project_meta (dict):
|
||||
|
||||
"""
|
||||
config_variables = config.get("variables", {})
|
||||
config_base_url = config.get("base_url", "")
|
||||
config_verify = config.get("verify", True)
|
||||
functions = project_mapping.get("functions", {})
|
||||
functions = project_meta.get("functions", {})
|
||||
|
||||
prepared_testcase_tests = []
|
||||
session_variables_set = set(config_variables.keys()) | (session_variables_set or set())
|
||||
@@ -1169,7 +1169,7 @@ def __prepare_testcase_tests(tests, config, project_mapping, session_variables_s
|
||||
test_dict["config"].setdefault("verify", config_verify)
|
||||
|
||||
# 3, testcase_def config => testcase_def test_dict
|
||||
test_dict = _parse_testcase(test_dict, project_mapping, session_variables_set)
|
||||
test_dict = _parse_testcase(test_dict, project_meta, session_variables_set)
|
||||
if not test_dict:
|
||||
continue
|
||||
|
||||
@@ -1231,7 +1231,7 @@ def __prepare_testcase_tests(tests, config, project_mapping, session_variables_s
|
||||
return prepared_testcase_tests
|
||||
|
||||
|
||||
def _parse_testcase(testcase, project_mapping, session_variables_set=None):
|
||||
def _parse_testcase(testcase, project_meta, session_variables_set=None):
|
||||
""" parse testcase
|
||||
|
||||
Args:
|
||||
@@ -1247,13 +1247,13 @@ def _parse_testcase(testcase, project_mapping, session_variables_set=None):
|
||||
try:
|
||||
prepared_config = __prepare_config(
|
||||
testcase["config"],
|
||||
project_mapping,
|
||||
project_meta,
|
||||
session_variables_set
|
||||
)
|
||||
prepared_testcase_tests = __prepare_testcase_tests(
|
||||
testcase["teststeps"],
|
||||
prepared_config,
|
||||
project_mapping,
|
||||
project_meta,
|
||||
session_variables_set
|
||||
)
|
||||
return {
|
||||
@@ -1275,7 +1275,7 @@ def _parse_testcase(testcase, project_mapping, session_variables_set=None):
|
||||
return None
|
||||
|
||||
|
||||
def __get_parsed_testsuite_testcases(testcases, testsuite_config, project_mapping):
|
||||
def __get_parsed_testsuite_testcases(testcases, testsuite_config, project_meta):
|
||||
""" override testscases with testsuite config variables, base_url and verify.
|
||||
|
||||
variables priority:
|
||||
@@ -1311,7 +1311,7 @@ def __get_parsed_testsuite_testcases(testcases, testsuite_config, project_mappin
|
||||
},
|
||||
"base_url": "http://127.0.0.1:5000"
|
||||
}
|
||||
project_mapping (dict):
|
||||
project_meta (dict):
|
||||
{
|
||||
"env": {},
|
||||
"functions": {}
|
||||
@@ -1320,7 +1320,7 @@ def __get_parsed_testsuite_testcases(testcases, testsuite_config, project_mappin
|
||||
"""
|
||||
testsuite_base_url = testsuite_config.get("base_url")
|
||||
testsuite_config_variables = testsuite_config.get("variables", {})
|
||||
functions = project_mapping.get("functions", {})
|
||||
functions = project_meta.get("functions", {})
|
||||
parsed_testcase_list = []
|
||||
|
||||
for testcase_name, testcase in testcases.items():
|
||||
@@ -1373,7 +1373,7 @@ def __get_parsed_testsuite_testcases(testcases, testsuite_config, project_mappin
|
||||
parsed_config_variables_copied,
|
||||
parameter_variables
|
||||
)
|
||||
parsed_testcase_copied = _parse_testcase(testcase_copied, project_mapping)
|
||||
parsed_testcase_copied = _parse_testcase(testcase_copied, project_meta)
|
||||
if not parsed_testcase_copied:
|
||||
continue
|
||||
parsed_testcase_copied["config"]["name"] = parse_lazy_data(
|
||||
@@ -1383,7 +1383,7 @@ def __get_parsed_testsuite_testcases(testcases, testsuite_config, project_mappin
|
||||
parsed_testcase_list.append(parsed_testcase_copied)
|
||||
|
||||
else:
|
||||
parsed_testcase = _parse_testcase(parsed_testcase, project_mapping)
|
||||
parsed_testcase = _parse_testcase(parsed_testcase, project_meta)
|
||||
if not parsed_testcase:
|
||||
continue
|
||||
parsed_testcase_list.append(parsed_testcase)
|
||||
@@ -1391,13 +1391,13 @@ def __get_parsed_testsuite_testcases(testcases, testsuite_config, project_mappin
|
||||
return parsed_testcase_list
|
||||
|
||||
|
||||
def _parse_testsuite(testsuite, project_mapping):
|
||||
def _parse_testsuite(testsuite, project_meta):
|
||||
testsuite.setdefault("config", {})
|
||||
prepared_config = __prepare_config(testsuite["config"], project_mapping)
|
||||
prepared_config = __prepare_config(testsuite["config"], project_meta)
|
||||
parsed_testcase_list = __get_parsed_testsuite_testcases(
|
||||
testsuite["testcases"],
|
||||
prepared_config,
|
||||
project_mapping
|
||||
project_meta
|
||||
)
|
||||
return parsed_testcase_list
|
||||
|
||||
@@ -1410,7 +1410,7 @@ def parse_tests(tests_mapping):
|
||||
tests_mapping (dict): project info and testcases list.
|
||||
|
||||
{
|
||||
"project_mapping": {
|
||||
"project_meta": {
|
||||
"PWD": "XXXXX",
|
||||
"functions": {},
|
||||
"variables": {}, # optional, priority 1
|
||||
@@ -1467,7 +1467,7 @@ def parse_tests(tests_mapping):
|
||||
}
|
||||
|
||||
"""
|
||||
project_mapping = tests_mapping.get("project_mapping", {})
|
||||
project_meta = tests_mapping.get("project_meta", {})
|
||||
testcases = []
|
||||
|
||||
for test_type in tests_mapping:
|
||||
@@ -1476,14 +1476,14 @@ def parse_tests(tests_mapping):
|
||||
# load testcases of testsuite
|
||||
testsuites = tests_mapping["testsuites"]
|
||||
for testsuite in testsuites:
|
||||
parsed_testcases = _parse_testsuite(testsuite, project_mapping)
|
||||
parsed_testcases = _parse_testsuite(testsuite, project_meta)
|
||||
for parsed_testcase in parsed_testcases:
|
||||
testcases.append(parsed_testcase)
|
||||
|
||||
elif test_type == "testcases":
|
||||
for testcase in tests_mapping["testcases"]:
|
||||
testcase["type"] = "testcase"
|
||||
parsed_testcase = _parse_testcase(testcase, project_mapping)
|
||||
parsed_testcase = _parse_testcase(testcase, project_meta)
|
||||
if not parsed_testcase:
|
||||
continue
|
||||
testcases.append(parsed_testcase)
|
||||
@@ -1499,7 +1499,7 @@ def parse_tests(tests_mapping):
|
||||
"path": api_content.pop("path", None),
|
||||
"type": api_content.pop("type", "api")
|
||||
}
|
||||
parsed_testcase = _parse_testcase(testcase, project_mapping)
|
||||
parsed_testcase = _parse_testcase(testcase, project_meta)
|
||||
if not parsed_testcase:
|
||||
continue
|
||||
testcases.append(parsed_testcase)
|
||||
|
||||
@@ -967,7 +967,7 @@ class TestParser(unittest.TestCase):
|
||||
)
|
||||
|
||||
def test_parse_parameters_mix(self):
|
||||
project_mapping = loader.load_project_data(os.path.join(os.getcwd(), "tests"))
|
||||
project_meta = loader.load_project_data(os.path.join(os.getcwd(), "tests"))
|
||||
|
||||
parameters = [
|
||||
{"user_agent": ["iOS/10.1", "iOS/10.2", "iOS/10.3"]},
|
||||
@@ -975,7 +975,7 @@ class TestParser(unittest.TestCase):
|
||||
{"username-password": "${parameterize(data/account.csv)}"}
|
||||
]
|
||||
cartesian_product_parameters = parser.parse_parameters(
|
||||
parameters, functions_mapping=project_mapping["functions"])
|
||||
parameters, functions_mapping=project_meta["functions"])
|
||||
self.assertEqual(
|
||||
len(cartesian_product_parameters),
|
||||
3 * 2 * 3
|
||||
@@ -1119,7 +1119,7 @@ class TestParser(unittest.TestCase):
|
||||
|
||||
def test_parse_tests_variable_with_function(self):
|
||||
tests_mapping = {
|
||||
"project_mapping": {
|
||||
"project_meta": {
|
||||
"functions": {
|
||||
"sum_two": sum_two,
|
||||
"gen_random_string": gen_random_string
|
||||
@@ -1172,7 +1172,7 @@ class TestParser(unittest.TestCase):
|
||||
|
||||
def test_parse_tests_variable_not_found(self):
|
||||
tests_mapping = {
|
||||
"project_mapping": {
|
||||
"project_meta": {
|
||||
"functions": {
|
||||
"sum_two": sum_two
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class Runner(object):
|
||||
|
||||
Examples:
|
||||
>>> tests_mapping = {
|
||||
"project_mapping": {
|
||||
"project_meta": {
|
||||
"functions": {}
|
||||
},
|
||||
"testcases": [
|
||||
|
||||
@@ -69,7 +69,7 @@ class HttpRunner(object):
|
||||
test.__doc__ = test_runner.config.name
|
||||
return test
|
||||
|
||||
project_meta = tests.project_mapping
|
||||
project_meta = tests.project_meta
|
||||
testcases = tests.testcases
|
||||
|
||||
prepared_testcases: List[unittest.TestSuite] = []
|
||||
@@ -169,7 +169,7 @@ class HttpRunner(object):
|
||||
""" run testcase/testsuite data
|
||||
"""
|
||||
tests = TestsMapping.parse_obj(tests_mapping)
|
||||
self.test_path = tests.project_mapping.test_path
|
||||
self.test_path = tests.project_meta.test_path
|
||||
|
||||
if self.save_tests:
|
||||
utils.dump_json_file(
|
||||
@@ -254,7 +254,7 @@ class HttpRunner(object):
|
||||
tests_mapping = loader.load_cases(path, dot_env_path)
|
||||
|
||||
if mapping:
|
||||
tests_mapping["project_mapping"]["variables"] = mapping
|
||||
tests_mapping["project_meta"]["variables"] = mapping
|
||||
|
||||
return self.run_tests(tests_mapping)
|
||||
|
||||
@@ -275,7 +275,7 @@ 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())
|
||||
project_working_directory = path_or_tests.get("project_meta", {}).get("PWD", os.getcwd())
|
||||
loader.init_pwd(project_working_directory)
|
||||
return self.run_tests(path_or_tests)
|
||||
else:
|
||||
|
||||
@@ -78,7 +78,7 @@ class ProjectMeta(BaseModel):
|
||||
|
||||
|
||||
class TestsMapping(BaseModel):
|
||||
project_mapping: ProjectMeta # TODO: rename to project_meta
|
||||
project_meta: ProjectMeta
|
||||
testcases: List[TestCase]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user