44
55
66def test_auto_mode_cmdline (pytester : Pytester ):
7+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
78 pytester .makepyfile (
89 dedent (
910 """\
@@ -22,6 +23,15 @@ async def test_a():
2223
2324
2425def test_auto_mode_cfg (pytester : Pytester ):
26+ pytester .makeini (
27+ dedent (
28+ """\
29+ [pytest]
30+ asyncio_default_fixture_loop_scope = function
31+ asyncio_mode = auto
32+ """
33+ )
34+ )
2535 pytester .makepyfile (
2636 dedent (
2737 """\
@@ -35,12 +45,12 @@ async def test_a():
3545 """
3646 )
3747 )
38- pytester .makefile (".ini" , pytest = "[pytest]\n asyncio_mode = auto\n " )
39- result = pytester .runpytest ()
48+ result = pytester .runpytest ("--asyncio-mode=auto" )
4049 result .assert_outcomes (passed = 1 )
4150
4251
4352def test_auto_mode_async_fixture (pytester : Pytester ):
53+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
4454 pytester .makepyfile (
4555 dedent (
4656 """\
@@ -65,6 +75,7 @@ async def test_a(fixture_a):
6575
6676
6777def test_auto_mode_method_fixture (pytester : Pytester ):
78+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
6879 pytester .makepyfile (
6980 dedent (
7081 """\
@@ -92,6 +103,7 @@ async def test_a(self, fixture_a):
92103
93104
94105def test_auto_mode_static_method (pytester : Pytester ):
106+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
95107 pytester .makepyfile (
96108 dedent (
97109 """\
@@ -113,6 +125,7 @@ async def test_a():
113125
114126
115127def test_auto_mode_static_method_fixture (pytester : Pytester ):
128+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
116129 pytester .makepyfile (
117130 dedent (
118131 """\
0 commit comments