Skip to content

Commit

Permalink
Fix async tests using unsafe fixtures
Browse files Browse the repository at this point in the history
With the latest version of pytest-asyncio, async tests run with
individual event loops, and so fixtures providing e.g. queues need to
use the same loop.

[noissue]

(cherry picked from commit f8ad314)
  • Loading branch information
mdellweg authored and patchback[bot] committed Dec 4, 2023
1 parent bee32ef commit 8929f19
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pulpcore/tests/unit/stages/test_stages.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import pytest
import pytest_asyncio

import mock

Expand All @@ -9,13 +10,13 @@
pytestmark = pytest.mark.usefixtures("fake_domain")


@pytest.fixture
def in_q():
@pytest_asyncio.fixture
async def in_q():
return asyncio.Queue()


@pytest.fixture
def stage(in_q):
@pytest_asyncio.fixture
async def stage(in_q):
stage = Stage()
stage._connect(in_q, None)
return stage
Expand Down

0 comments on commit 8929f19

Please sign in to comment.