mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +08:00
change: remove TConfig functions field
This commit is contained in:
@@ -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,), {})
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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 = []
|
||||||
|
|||||||
Reference in New Issue
Block a user