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 = """
84
84
--color=yes
85
85
"""
86
86
# filterwarnings=error
87
+ asyncio_default_fixture_loop_scope = " function"
87
88
88
89
[tool .mypy ]
89
90
ignore_missing_imports = true
Original file line number Diff line number Diff line change @@ -59,12 +59,12 @@ def benchmark():
59
59
60
60
61
61
@pytest_asyncio .fixture
62
- async def aio_session (event_loop ):
62
+ async def aio_session ():
63
63
async with aiohttp .ClientSession () as session :
64
64
yield session
65
65
66
66
67
67
@pytest_asyncio .fixture
68
- async def aio_connector (event_loop ):
68
+ async def aio_connector ():
69
69
async with aiohttp .TCPConnector (limit_per_host = 16 ) as conn :
70
70
yield conn
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
+ import asyncio
4
+
3
5
import hypothesis .strategies as st
4
6
import pytest
5
7
import pytest_asyncio
@@ -56,23 +58,19 @@ async def test_basic(monkeypatch):
56
58
57
59
58
60
@pytest_asyncio .fixture
59
- @pytest .mark .asyncio
60
- async def conflict_state (request , event_loop ):
61
+ async def conflict_state (request ):
61
62
a = MemoryStorage ()
62
63
b = MemoryStorage ()
63
64
status = {}
64
65
await a .set_meta ("foo" , "bar" )
65
66
await b .set_meta ("foo" , "baz" )
66
67
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
74
72
75
- request .addfinalizer (cleanup )
73
+ request .addfinalizer (lambda : asyncio . run ( do_cleanup ()) )
76
74
77
75
return a , b , status
78
76
You can’t perform that action at this time.
0 commit comments