diff --git a/requirements/test.txt b/requirements/test.txt index a861c23e..3a8f391c 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -5,7 +5,7 @@ isort==6.0.1 mypy==1.16.1 types-protobuf==6.30.2.20250516 pytest>=6.2.4,<9 -pytest-asyncio==0.26.0 +pytest-asyncio==1.0.0 pytest-codspeed==3.2.0 pytest-cov>=4.1.0 pytest-timeout==2.4.0 diff --git a/tests/conftest.py b/tests/conftest.py index 680d655c..f7e82b29 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -87,7 +87,7 @@ async def auth_client(): @pytest.fixture -def connection_params(event_loop: asyncio.AbstractEventLoop) -> ConnectionParams: +def connection_params() -> ConnectionParams: return get_mock_connection_params() @@ -263,10 +263,15 @@ def long_repr_strings() -> Generator[None]: @pytest.fixture(autouse=True) -def verify_no_lingering_tasks( - event_loop: asyncio.AbstractEventLoop, -) -> Generator[None]: +def verify_no_lingering_tasks() -> Generator[None]: """Verify that all tasks are cleaned up.""" + try: + event_loop = asyncio.get_running_loop() + except RuntimeError: + # No event loop running, nothing to verify + yield + return + tasks_before = asyncio.all_tasks(event_loop) yield