-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
When one finalizer raises an exception, the finalizers remain in the scope stack will be skipped.
Test case:
def test_teardown_multiple_scopes_one_fails(self, testdir):
module_teardown = []
def fin_func():
raise Exception("oops1")
def fin_module():
module_teardown.append("fin_module")
item = testdir.getitem("def test_func(): pass")
ss = runner.SetupState()
ss.addfinalizer(fin_module, item.listchain()[-2])
ss.addfinalizer(fin_func, item)
ss.prepare(item)
with pytest.raises(Exception) as err:
ss.teardown_exact(item, None)
assert module_teardown
Metadata
Metadata
Assignees
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytype: bugproblem that needs to be addressedproblem that needs to be addressed