From 454c70d062a45666b0ed01af10f7be5e2b00312d Mon Sep 17 00:00:00 2001 From: debugtalk Date: Fri, 15 May 2020 11:39:17 +0800 Subject: [PATCH] change: remove TConfig functions field --- httprunner/api.py | 2 -- httprunner/runner.py | 7 +++---- httprunner/schema.py | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/httprunner/api.py b/httprunner/api.py index 7afdaab9..a58e8f99 100644 --- a/httprunner/api.py +++ b/httprunner/api.py @@ -73,8 +73,6 @@ class HttpRunner(object): for testcase in testcases: testcase.config.variables.update(project_meta.variables) - testcase.config.functions.update(project_meta.functions) - test_runner = TestCaseRunner(testcase.config, testcase.teststeps) TestSequense = type("TestSequense", (unittest.TestCase,), {}) diff --git a/httprunner/runner.py b/httprunner/runner.py index 5ebb555e..bbd96c4d 100644 --- a/httprunner/runner.py +++ b/httprunner/runner.py @@ -36,7 +36,6 @@ class HttpRunner(object): self.success: bool = True # indicate testcase execution result self.project_data = load_project_meta(self.config.path) - self.config.functions = self.project_data.functions def with_variables(self, **variables: VariablesMapping) -> "HttpRunner": self.config.variables.update(variables) @@ -49,7 +48,7 @@ class HttpRunner(object): # parse request_dict = step.request.dict() parsed_request_dict = parse_data( - request_dict, step.variables, self.config.functions + request_dict, step.variables, self.project_data.functions ) # prepare arguments @@ -100,7 +99,7 @@ class HttpRunner(object): # validate validators = step.validators try: - resp_obj.validate(validators, variables_mapping, self.config.functions) + resp_obj.validate(validators, variables_mapping, self.project_data.functions) self.session.data.success = True except ValidationFailure: self.session.data.success = False @@ -163,7 +162,7 @@ class HttpRunner(object): step.variables.update(self.session_variables) # parse variables step.variables = parse_variables_mapping( - step.variables, self.config.functions + step.variables, self.project_data.functions ) # run step extract_mapping = self.__run_step(step) diff --git a/httprunner/schema.py b/httprunner/schema.py index 6481b953..81497b7e 100644 --- a/httprunner/schema.py +++ b/httprunner/schema.py @@ -36,7 +36,6 @@ class TConfig(BaseModel): verify: Verify = False base_url: BaseUrl = "" variables: VariablesMapping = {} - functions: FunctionsMapping = {} setup_hooks: Hook = [] teardown_hooks: Hook = [] export: Export = []