From 9b0e60fa238575e01be21a395491d0ebf4e260c2 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 8 Jun 2020 12:51:32 +0800 Subject: [PATCH] fix: testsuite variables override testcase config variables --- httprunner/make.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/httprunner/make.py b/httprunner/make.py index 967e8d74..778fd783 100644 --- a/httprunner/make.py +++ b/httprunner/make.py @@ -407,11 +407,16 @@ def make_testsuite(testsuite: Dict) -> NoReturn: if "verify" in testsuite_config: testcase_dict["config"]["verify"] = testsuite_config["verify"] # override variables + # testsuite config variables > testsuite testcase variables testcase_variables = convert_variables( testcase.get("variables", {}), testcase_path ) testcase_variables.update(testsuite_variables) - testcase_dict["config"]["variables"] = testcase_variables + # testsuite testcase variables > testcase config variables + testcase_dict["config"]["variables"] = convert_variables( + testcase_dict["config"].get("variables", {}), testcase_path + ) + testcase_dict["config"]["variables"].update(testcase_variables) # make testcase testcase_pytest_path = make_testcase(testcase_dict, testsuite_dir)