diff --git a/tests/test_sockets.py b/tests/test_sockets.py index b5143df0..9f7d3518 100644 --- a/tests/test_sockets.py +++ b/tests/test_sockets.py @@ -149,6 +149,11 @@ def _identity(v: _T) -> _T: ) +@pytest.fixture +def gc_collect() -> None: + gc.collect() + + @_ignore_win32_resource_warnings class TestTCPStream: @pytest.fixture @@ -490,7 +495,7 @@ def serve() -> None: @pytest.mark.parametrize("anyio_backend", ["asyncio"]) async def test_unretrieved_future_exception_server_crash( - self, family: AnyIPAddressFamily, caplog: LogCaptureFixture + self, family: AnyIPAddressFamily, caplog: LogCaptureFixture, gc_collect: None ) -> None: """ Test that there won't be any leftover Futures that don't get their exceptions