change: remove TConfig functions field

This commit is contained in:
debugtalk
2020-05-15 11:39:17 +08:00
parent 647d8c6312
commit 454c70d062
3 changed files with 3 additions and 7 deletions
-2
View File
@@ -73,8 +73,6 @@ class HttpRunner(object):
for testcase in testcases: for testcase in testcases:
testcase.config.variables.update(project_meta.variables) testcase.config.variables.update(project_meta.variables)
testcase.config.functions.update(project_meta.functions)
test_runner = TestCaseRunner(testcase.config, testcase.teststeps) test_runner = TestCaseRunner(testcase.config, testcase.teststeps)
TestSequense = type("TestSequense", (unittest.TestCase,), {}) TestSequense = type("TestSequense", (unittest.TestCase,), {})
+3 -4
View File
@@ -36,7 +36,6 @@ class HttpRunner(object):
self.success: bool = True # indicate testcase execution result self.success: bool = True # indicate testcase execution result
self.project_data = load_project_meta(self.config.path) self.project_data = load_project_meta(self.config.path)
self.config.functions = self.project_data.functions
def with_variables(self, **variables: VariablesMapping) -> "HttpRunner": def with_variables(self, **variables: VariablesMapping) -> "HttpRunner":
self.config.variables.update(variables) self.config.variables.update(variables)
@@ -49,7 +48,7 @@ class HttpRunner(object):
# parse # parse
request_dict = step.request.dict() request_dict = step.request.dict()
parsed_request_dict = parse_data( parsed_request_dict = parse_data(
request_dict, step.variables, self.config.functions request_dict, step.variables, self.project_data.functions
) )
# prepare arguments # prepare arguments
@@ -100,7 +99,7 @@ class HttpRunner(object):
# validate # validate
validators = step.validators validators = step.validators
try: 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 self.session.data.success = True
except ValidationFailure: except ValidationFailure:
self.session.data.success = False self.session.data.success = False
@@ -163,7 +162,7 @@ class HttpRunner(object):
step.variables.update(self.session_variables) step.variables.update(self.session_variables)
# parse variables # parse variables
step.variables = parse_variables_mapping( step.variables = parse_variables_mapping(
step.variables, self.config.functions step.variables, self.project_data.functions
) )
# run step # run step
extract_mapping = self.__run_step(step) extract_mapping = self.__run_step(step)
-1
View File
@@ -36,7 +36,6 @@ class TConfig(BaseModel):
verify: Verify = False verify: Verify = False
base_url: BaseUrl = "" base_url: BaseUrl = ""
variables: VariablesMapping = {} variables: VariablesMapping = {}
functions: FunctionsMapping = {}
setup_hooks: Hook = [] setup_hooks: Hook = []
teardown_hooks: Hook = [] teardown_hooks: Hook = []
export: Export = [] export: Export = []