Update pytest-asyncio to 1.0.0 (#145988)

* Update pytest-asyncio to 1.0.0

* Remove event_loop fixture uses
This commit is contained in:
Marc Mueller
2025-06-02 06:12:22 +02:00
committed by GitHub
parent dd85a1e5f0
commit 5e377b89fc
11 changed files with 22 additions and 35 deletions

View File

@@ -330,18 +330,18 @@ def long_repr_strings() -> Generator[None]:
@pytest.fixture(autouse=True)
def enable_event_loop_debug(event_loop: asyncio.AbstractEventLoop) -> None:
def enable_event_loop_debug() -> None:
"""Enable event loop debug mode."""
event_loop.set_debug(True)
asyncio.get_event_loop().set_debug(True)
@pytest.fixture(autouse=True)
def verify_cleanup(
event_loop: asyncio.AbstractEventLoop,
expected_lingering_tasks: bool,
expected_lingering_timers: bool,
) -> Generator[None]:
"""Verify that the test has cleaned up resources correctly."""
event_loop = asyncio.get_event_loop()
threads_before = frozenset(threading.enumerate())
tasks_before = asyncio.all_tasks(event_loop)
yield
@@ -492,9 +492,7 @@ def aiohttp_client_cls() -> type[CoalescingClient]:
@pytest.fixture
def aiohttp_client(
event_loop: asyncio.AbstractEventLoop,
) -> Generator[ClientSessionGenerator]:
def aiohttp_client() -> Generator[ClientSessionGenerator]:
"""Override the default aiohttp_client since 3.x does not support aiohttp_client_cls.
Remove this when upgrading to 4.x as aiohttp_client_cls
@@ -504,7 +502,7 @@ def aiohttp_client(
aiohttp_client(server, **kwargs)
aiohttp_client(raw_server, **kwargs)
"""
loop = event_loop
loop = asyncio.get_event_loop()
clients = []
async def go(