Skip to content

Commit 466470e

Browse files
committed
refactor: Addressed warnings about missing default fixture loop scope in tests/test_asyncio_fixture.py.
1 parent a6fb77f commit 466470e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test_asyncio_fixture.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from textwrap import dedent
33

44
import pytest
5+
from pytest import Pytester
56

67
import pytest_asyncio
78

@@ -43,8 +44,9 @@ async def test_fixture_with_params(fixture_with_params):
4344

4445

4546
@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]\nasyncio_default_fixture_loop_scope = function")
49+
pytester.makepyfile(
4850
dedent(
4951
"""\
5052
import pytest_asyncio
@@ -60,5 +62,5 @@ def test_sync_function_uses_async_fixture(always_true):
6062
"""
6163
)
6264
)
63-
result = testdir.runpytest(f"--asyncio-mode={mode}")
65+
result = pytester.runpytest(f"--asyncio-mode={mode}")
6466
result.assert_outcomes(passed=1)

0 commit comments

Comments
 (0)