mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 10:39:40 +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()
|
||||
|
||||
config_dict = config_dict or {}
|
||||
self.init_config(config_dict, "testset")
|
||||
|
||||
# testset setup hooks
|
||||
testset_setup_hooks = config_dict.pop("setup_hooks", [])
|
||||
if testset_setup_hooks:
|
||||
self.do_hook_actions(testset_setup_hooks)
|
||||
|
||||
# testset 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):
|
||||
if self.testset_teardown_hooks:
|
||||
self.do_hook_actions(self.testset_teardown_hooks)
|
||||
|
||||
Reference in New Issue
Block a user