(self, pytester: Pytester)
| 844 | assert "request" in item.funcargs |
| 845 | |
| 846 | def test_request_addfinalizer(self, pytester: Pytester) -> None: |
| 847 | item = pytester.getitem( |
| 848 | """ |
| 849 | import pytest |
| 850 | teardownlist = [] |
| 851 | @pytest.fixture |
| 852 | def something(request): |
| 853 | request.addfinalizer(lambda: teardownlist.append(1)) |
| 854 | def test_func(something): pass |
| 855 | """ |
| 856 | ) |
| 857 | assert isinstance(item, Function) |
| 858 | item.session._setupstate.setup(item) |
| 859 | item._request._fillfixtures() |
| 860 | # successively check finalization calls |
| 861 | parent = item.getparent(pytest.Module) |
| 862 | assert parent is not None |
| 863 | teardownlist = parent.obj.teardownlist |
| 864 | ss = item.session._setupstate |
| 865 | assert not teardownlist |
| 866 | ss.teardown_exact(None) |
| 867 | print(ss.stack) |
| 868 | assert teardownlist == [1] |
| 869 | |
| 870 | def test_request_addfinalizer_failing_setup(self, pytester: Pytester) -> None: |
| 871 | pytester.makepyfile( |
nothing calls this directly
no test coverage detected