feat: make testcase with weight

This commit is contained in:
debugtalk
2020-06-18 18:46:34 +08:00
parent 5c4460def4
commit b0e5ccb1b6
14 changed files with 26 additions and 11 deletions

View File

@@ -184,6 +184,9 @@ def make_config_chain_style(config: Dict) -> Text:
if "export" in config:
config_chain_style += f'.export(*{config["export"]})'
if "weight" in config:
config_chain_style += f'.locust_weight({config["weight"]})'
return config_chain_style
@@ -442,6 +445,10 @@ def make_testsuite(testsuite: Dict) -> NoReturn:
)
testcase_dict["config"]["variables"].update(testcase_variables)
# override weight
weight = testcase.get("weight", 1)
testcase_dict["config"]["weight"] = weight
# make testcase
testcase_pytest_path = make_testcase(testcase_dict, testsuite_dir)
pytest_files_run_set.add(testcase_pytest_path)