1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
From: Colin Watson <cjwatson@debian.org>
Date: Thu, 18 Sep 2025 07:28:24 +0100
Subject: Port to pytest-asyncio >= 1.0.0
See
https://pytest-asyncio.readthedocs.io/en/latest/how-to-guides/migrate_from_0_21.html.
This should allow #595 to work.
---
tests/conftest.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index 99f74d9..78d6963 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,4 +1,5 @@
-from asyncio import AbstractEventLoop
+from asyncio import AbstractEventLoop, get_running_loop
+from collections.abc import AsyncIterator
from typing import cast
import pytest
@@ -14,6 +15,7 @@ def debug(request: pytest.FixtureRequest) -> bool:
@pytest.fixture(autouse=True)
-def loop(event_loop: AbstractEventLoop, debug: bool) -> AbstractEventLoop:
+async def loop(debug: bool) -> AsyncIterator[AbstractEventLoop]:
+ event_loop = get_running_loop()
event_loop.set_debug(debug)
- return event_loop
+ yield event_loop
|