Skip to content

Commit

Permalink
Make qualification work with pytest-dev/pytest-asyncio#871
Browse files Browse the repository at this point in the history
This should not be merged until that PR is released and we switch to that
version (probably 0.24).
  • Loading branch information
bmerry committed Jul 24, 2024
1 parent a801b91 commit b1d647a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions qualification/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import matplotlib.style
import pytest
import pytest_asyncio
import pytest_check
from katsdpservices import get_interface_address

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

items.sort(key=key)


# Need to redefine this from pytest-asyncio to have it at session scope
@pytest.fixture(scope="session")
def event_loop(): # noqa: D103
loop = asyncio.get_event_loop_policy().new_event_loop()
yield loop
loop.close()
scope_marker = pytest.mark.asyncio(loop_scope="session")
for item in items:
if pytest_asyncio.is_async_test(item):
item.add_marker(scope_marker, append=False)


@pytest.fixture(scope="package")
Expand Down

0 comments on commit b1d647a

Please sign in to comment.