(self, pytester: Pytester)
| 82 | assert r == ["fin3", "fin1"] |
| 83 | |
| 84 | def test_teardown_multiple_fail(self, pytester: Pytester) -> None: |
| 85 | def fin1(): |
| 86 | raise Exception("oops1") |
| 87 | |
| 88 | def fin2(): |
| 89 | raise Exception("oops2") |
| 90 | |
| 91 | item = pytester.getitem("def test_func(): pass") |
| 92 | ss = item.session._setupstate |
| 93 | ss.setup(item) |
| 94 | ss.addfinalizer(fin1, item) |
| 95 | ss.addfinalizer(fin2, item) |
| 96 | with pytest.raises(ExceptionGroup) as err: |
| 97 | ss.teardown_exact(None) |
| 98 | |
| 99 | # Note that finalizers are run LIFO, but because FIFO is more intuitive for |
| 100 | # users we reverse the order of messages, and see the error from fin1 first. |
| 101 | err1, err2 = err.value.exceptions |
| 102 | assert err1.args == ("oops1",) |
| 103 | assert err2.args == ("oops2",) |
| 104 | |
| 105 | def test_teardown_multiple_scopes_one_fails(self, pytester: Pytester) -> None: |
| 106 | module_teardown = [] |
nothing calls this directly
no test coverage detected