Skip to content

Commit b1d647a

Browse files
committed
Make qualification work with pytest-dev/pytest-asyncio#871
This should not be merged until that PR is released and we switch to that version (probably 0.24).
1 parent a801b91 commit b1d647a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

qualification/conftest.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import matplotlib.style
3030
import pytest
31+
import pytest_asyncio
3132
import pytest_check
3233
from katsdpservices import get_interface_address
3334

@@ -176,14 +177,10 @@ def key(item: pytest.Item) -> tuple:
176177
return tuple(ans)
177178

178179
items.sort(key=key)
179-
180-
181-
# Need to redefine this from pytest-asyncio to have it at session scope
182-
@pytest.fixture(scope="session")
183-
def event_loop(): # noqa: D103
184-
loop = asyncio.get_event_loop_policy().new_event_loop()
185-
yield loop
186-
loop.close()
180+
scope_marker = pytest.mark.asyncio(loop_scope="session")
181+
for item in items:
182+
if pytest_asyncio.is_async_test(item):
183+
item.add_marker(scope_marker, append=False)
187184

188185

189186
@pytest.fixture(scope="package")

0 commit comments

Comments
 (0)