From 24e6b408e49a7cd5d44a311c0eb4407946af71ea Mon Sep 17 00:00:00 2001 From: debugtalk Date: Fri, 23 Nov 2018 11:41:36 +0800 Subject: [PATCH] remove empty variables in saved tests --- httprunner/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/httprunner/api.py b/httprunner/api.py index a00ab166..2867bc74 100644 --- a/httprunner/api.py +++ b/httprunner/api.py @@ -153,8 +153,9 @@ class HttpRunner(object): tests_mapping = path_or_testcases elif validator.is_testcase_path(path_or_testcases): tests_mapping = loader.load_tests(path_or_testcases, dot_env_path) - tests_mapping["project_mapping"]["variables"] = mapping or {} tests_mapping["project_mapping"]["test_path"] = path_or_testcases + if "variables" in tests_mapping["project_mapping"]: + tests_mapping["project_mapping"]["variables"] = mapping else: raise exceptions.ParamsError("invalid testcase path or testcases.")