mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 22:44:05 +08:00
load_locust_tests: parse config
This commit is contained in:
@@ -1052,8 +1052,7 @@ def load_locust_tests(path, dot_env_path=None):
|
|||||||
|
|
||||||
config = {
|
config = {
|
||||||
"variables": project_mapping["debugtalk"]["variables"],
|
"variables": project_mapping["debugtalk"]["variables"],
|
||||||
"functions": project_mapping["debugtalk"]["functions"],
|
"functions": project_mapping["debugtalk"]["functions"]
|
||||||
"refs": project_mapping
|
|
||||||
}
|
}
|
||||||
tests = []
|
tests = []
|
||||||
for item in raw_testcase:
|
for item in raw_testcase:
|
||||||
@@ -1067,6 +1066,35 @@ def load_locust_tests(path, dot_env_path=None):
|
|||||||
for _ in range(weight):
|
for _ in range(weight):
|
||||||
tests.append(teststeps)
|
tests.append(teststeps)
|
||||||
|
|
||||||
|
# parse config variables
|
||||||
|
raw_config_variables = config.get("variables", [])
|
||||||
|
parsed_config_variables = parser.parse_data(
|
||||||
|
raw_config_variables,
|
||||||
|
project_mapping["debugtalk"]["variables"],
|
||||||
|
project_mapping["debugtalk"]["functions"]
|
||||||
|
)
|
||||||
|
|
||||||
|
# priority: passed in > debugtalk.py > parameters > variables
|
||||||
|
# override variables mapping with parameters mapping
|
||||||
|
config_variables = utils.override_mapping_list(
|
||||||
|
parsed_config_variables, {})
|
||||||
|
# merge debugtalk.py module variables
|
||||||
|
config_variables.update(project_mapping["debugtalk"]["variables"])
|
||||||
|
|
||||||
|
# parse config name
|
||||||
|
config["name"] = parser.parse_data(
|
||||||
|
config.get("name", ""),
|
||||||
|
config_variables,
|
||||||
|
project_mapping["debugtalk"]["functions"]
|
||||||
|
)
|
||||||
|
|
||||||
|
# parse config request
|
||||||
|
config["request"] = parser.parse_data(
|
||||||
|
config.get("request", {}),
|
||||||
|
config_variables,
|
||||||
|
project_mapping["debugtalk"]["functions"]
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"config": config,
|
"config": config,
|
||||||
"tests": tests
|
"tests": tests
|
||||||
|
|||||||
Reference in New Issue
Block a user