File tree 1 file changed +5
-3
lines changed 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 2
2
from textwrap import dedent
3
3
4
4
import pytest
5
+ from pytest import Pytester
5
6
6
7
import pytest_asyncio
7
8
@@ -43,8 +44,9 @@ async def test_fixture_with_params(fixture_with_params):
43
44
44
45
45
46
@pytest .mark .parametrize ("mode" , ("auto" , "strict" ))
46
- def test_sync_function_uses_async_fixture (testdir , mode ):
47
- testdir .makepyfile (
47
+ def test_sync_function_uses_async_fixture (pytester : Pytester , mode ):
48
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
49
+ pytester .makepyfile (
48
50
dedent (
49
51
"""\
50
52
import pytest_asyncio
@@ -60,5 +62,5 @@ def test_sync_function_uses_async_fixture(always_true):
60
62
"""
61
63
)
62
64
)
63
- result = testdir .runpytest (f"--asyncio-mode={ mode } " )
65
+ result = pytester .runpytest (f"--asyncio-mode={ mode } " )
64
66
result .assert_outcomes (passed = 1 )
You can’t perform that action at this time.
0 commit comments