mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-09 01:39:39 +08:00
fix #327: handle teardown hooks when exception occured in initilization
This commit is contained in:
@@ -14,16 +14,17 @@ class Runner(object):
|
|||||||
self.context = Context()
|
self.context = Context()
|
||||||
|
|
||||||
config_dict = config_dict or {}
|
config_dict = config_dict or {}
|
||||||
self.init_config(config_dict, "testset")
|
|
||||||
|
|
||||||
# testset setup hooks
|
# testset setup hooks
|
||||||
testset_setup_hooks = config_dict.pop("setup_hooks", [])
|
testset_setup_hooks = config_dict.pop("setup_hooks", [])
|
||||||
if testset_setup_hooks:
|
|
||||||
self.do_hook_actions(testset_setup_hooks)
|
|
||||||
|
|
||||||
# testset teardown hooks
|
# testset teardown hooks
|
||||||
self.testset_teardown_hooks = config_dict.pop("teardown_hooks", [])
|
self.testset_teardown_hooks = config_dict.pop("teardown_hooks", [])
|
||||||
|
|
||||||
|
self.init_config(config_dict, "testset")
|
||||||
|
|
||||||
|
if testset_setup_hooks:
|
||||||
|
self.do_hook_actions(testset_setup_hooks)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.testset_teardown_hooks:
|
if self.testset_teardown_hooks:
|
||||||
self.do_hook_actions(self.testset_teardown_hooks)
|
self.do_hook_actions(self.testset_teardown_hooks)
|
||||||
|
|||||||
Reference in New Issue
Block a user