Skip to content

Commit b61095a

Browse files
committed
Async fixtures must be marked as such
pytest_asyncio now uses strict mode by default.
1 parent 278e6de commit b61095a

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

tests/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import aiohttp
88
import click_log
99
import pytest
10+
import pytest_asyncio
1011
from hypothesis import HealthCheck
1112
from hypothesis import Verbosity
1213
from hypothesis import settings
@@ -54,13 +55,13 @@ def benchmark():
5455
settings.load_profile("dev")
5556

5657

57-
@pytest.fixture
58+
@pytest_asyncio.fixture
5859
async def aio_session(event_loop):
5960
async with aiohttp.ClientSession() as session:
6061
yield session
6162

6263

63-
@pytest.fixture
64+
@pytest_asyncio.fixture
6465
async def aio_connector(event_loop):
6566
async with aiohttp.TCPConnector(limit_per_host=16) as conn:
6667
yield conn

tests/storage/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import aiostream
88
import pytest
9+
import pytest_asyncio
910

1011
from vdirsyncer import exceptions
1112
from vdirsyncer.storage.base import normalize_meta_value
@@ -50,7 +51,7 @@ def get_storage_args(self):
5051
"""
5152
raise NotImplementedError()
5253

53-
@pytest.fixture
54+
@pytest_asyncio.fixture
5455
async def s(self, get_storage_args):
5556
rv = self.storage_class(**await get_storage_args())
5657
return rv

tests/storage/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import aiostream
99
import pytest
10+
import pytest_asyncio
1011
import requests
1112

1213

@@ -83,7 +84,7 @@ def xandikos_server():
8384
yield
8485

8586

86-
@pytest.fixture
87+
@pytest_asyncio.fixture
8788
async def slow_create_collection(request, aio_connector):
8889
# We need to properly clean up because otherwise we might run into
8990
# storage limits.

tests/unit/test_metasync.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import hypothesis.strategies as st
22
import pytest
3+
import pytest_asyncio
34
from hypothesis import example
45
from hypothesis import given
56

@@ -52,7 +53,7 @@ async def test_basic(monkeypatch):
5253
assert not await a.get_meta("foo") and not await b.get_meta("foo")
5354

5455

55-
@pytest.fixture
56+
@pytest_asyncio.fixture
5657
@pytest.mark.asyncio
5758
async def conflict_state(request, event_loop):
5859
a = MemoryStorage()
@@ -74,7 +75,7 @@ async def do_cleanup():
7475
return a, b, status
7576

7677

77-
@pytest.mark.asyncio
78+
@pytest_asyncio.fixture
7879
async def test_conflict(conflict_state):
7980
a, b, status = conflict_state
8081

0 commit comments

Comments
 (0)