Remove references to obsolete event_loop fixture

It's gone from the latest pytest-asyncio.
This commit is contained in:
Hugo Osvaldo Barrera 2025-08-25 17:01:16 +02:00
parent 2c6dc4cddf
commit 164559ad7a
3 changed files with 11 additions and 12 deletions

View file

@ -84,6 +84,7 @@ addopts = """
--color=yes --color=yes
""" """
# filterwarnings=error # filterwarnings=error
asyncio_default_fixture_loop_scope = "function"
[tool.mypy] [tool.mypy]
ignore_missing_imports = true ignore_missing_imports = true

View file

@ -59,12 +59,12 @@ else:
@pytest_asyncio.fixture @pytest_asyncio.fixture
async def aio_session(event_loop): async def aio_session():
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
yield session yield session
@pytest_asyncio.fixture @pytest_asyncio.fixture
async def aio_connector(event_loop): async def aio_connector():
async with aiohttp.TCPConnector(limit_per_host=16) as conn: async with aiohttp.TCPConnector(limit_per_host=16) as conn:
yield conn yield conn

View file

@ -1,5 +1,7 @@
from __future__ import annotations from __future__ import annotations
import asyncio
import hypothesis.strategies as st import hypothesis.strategies as st
import pytest import pytest
import pytest_asyncio import pytest_asyncio
@ -56,23 +58,19 @@ async def test_basic(monkeypatch):
@pytest_asyncio.fixture @pytest_asyncio.fixture
@pytest.mark.asyncio async def conflict_state(request):
async def conflict_state(request, event_loop):
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
status = {} status = {}
await a.set_meta("foo", "bar") await a.set_meta("foo", "bar")
await b.set_meta("foo", "baz") await b.set_meta("foo", "baz")
def cleanup(): async def do_cleanup():
async def do_cleanup(): assert await a.get_meta("foo") == "bar"
assert await a.get_meta("foo") == "bar" assert await b.get_meta("foo") == "baz"
assert await b.get_meta("foo") == "baz" assert not status
assert not status
event_loop.run_until_complete(do_cleanup()) request.addfinalizer(lambda: asyncio.run(do_cleanup()))
request.addfinalizer(cleanup)
return a, b, status return a, b, status