File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff 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 ]
8990ignore_missing_imports = true
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import asyncio
4+
35import hypothesis .strategies as st
46import pytest
57import 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
You can’t perform that action at this time.
0 commit comments