Skip to content

Commit a6fb77f

Browse files
committed
refactor: Addressed warnings about missing default fixture loop scope in test_strict_mode.
1 parent 11b2854 commit a6fb77f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/modes/test_strict_mode.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
def test_strict_mode_cmdline(pytester: Pytester):
7+
pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function")
78
pytester.makepyfile(
89
dedent(
910
"""\
@@ -23,6 +24,15 @@ async def test_a():
2324

2425

2526
def test_strict_mode_cfg(pytester: Pytester):
27+
pytester.makeini(
28+
dedent(
29+
"""\
30+
[pytest]
31+
asyncio_default_fixture_loop_scope = function
32+
asyncio_mode = strict
33+
"""
34+
)
35+
)
2636
pytester.makepyfile(
2737
dedent(
2838
"""\
@@ -37,12 +47,12 @@ async def test_a():
3747
"""
3848
)
3949
)
40-
pytester.makefile(".ini", pytest="[pytest]\nasyncio_mode = strict\n")
4150
result = pytester.runpytest()
4251
result.assert_outcomes(passed=1)
4352

4453

4554
def test_strict_mode_method_fixture(pytester: Pytester):
55+
pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function")
4656
pytester.makepyfile(
4757
dedent(
4858
"""\
@@ -71,6 +81,7 @@ async def test_a(self, fixture_a):
7181

7282

7383
def test_strict_mode_ignores_unmarked_coroutine(pytester: Pytester):
84+
pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function")
7485
pytester.makepyfile(
7586
dedent(
7687
"""\
@@ -87,6 +98,7 @@ async def test_anything():
8798

8899

89100
def test_strict_mode_ignores_unmarked_fixture(pytester: Pytester):
101+
pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function")
90102
pytester.makepyfile(
91103
dedent(
92104
"""\

0 commit comments

Comments
 (0)