Skip to content

Commit 2e55741

Browse files
committed
Remove references to obsolete event_loop fixture
It's gone from the latest pytest-asyncio.
1 parent 24bf7e5 commit 2e55741

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ addopts = """
8484
--color=yes
8585
"""
8686
# filterwarnings=error
87+
asyncio_default_fixture_loop_scope = "function"
8788

8889
[tool.mypy]
8990
ignore_missing_imports = true

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ def benchmark():
5959

6060

6161
@pytest_asyncio.fixture
62-
async def aio_session(event_loop):
62+
async def aio_session():
6363
async with aiohttp.ClientSession() as session:
6464
yield session
6565

6666

6767
@pytest_asyncio.fixture
68-
async def aio_connector(event_loop):
68+
async def aio_connector():
6969
async with aiohttp.TCPConnector(limit_per_host=16) as conn:
7070
yield conn

tests/unit/test_metasync.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
import asyncio
4+
35
import hypothesis.strategies as st
46
import pytest
57
import pytest_asyncio
@@ -56,23 +58,19 @@ async def test_basic(monkeypatch):
5658

5759

5860
@pytest_asyncio.fixture
59-
@pytest.mark.asyncio
60-
async def conflict_state(request, event_loop):
61+
async def conflict_state(request):
6162
a = MemoryStorage()
6263
b = MemoryStorage()
6364
status = {}
6465
await a.set_meta("foo", "bar")
6566
await b.set_meta("foo", "baz")
6667

67-
def cleanup():
68-
async def do_cleanup():
69-
assert await a.get_meta("foo") == "bar"
70-
assert await b.get_meta("foo") == "baz"
71-
assert not status
72-
73-
event_loop.run_until_complete(do_cleanup())
68+
async def do_cleanup():
69+
assert await a.get_meta("foo") == "bar"
70+
assert await b.get_meta("foo") == "baz"
71+
assert not status
7472

75-
request.addfinalizer(cleanup)
73+
request.addfinalizer(lambda: asyncio.run(do_cleanup()))
7674

7775
return a, b, status
7876

0 commit comments

Comments
 (0)