4
4
5
5
6
6
def test_auto_mode_cmdline (pytester : Pytester ):
7
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
7
8
pytester .makepyfile (
8
9
dedent (
9
10
"""\
@@ -22,6 +23,15 @@ async def test_a():
22
23
23
24
24
25
def 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
+ )
25
35
pytester .makepyfile (
26
36
dedent (
27
37
"""\
@@ -35,12 +45,12 @@ async def test_a():
35
45
"""
36
46
)
37
47
)
38
- pytester .makefile (".ini" , pytest = "[pytest]\n asyncio_mode = auto\n " )
39
- result = pytester .runpytest ()
48
+ result = pytester .runpytest ("--asyncio-mode=auto" )
40
49
result .assert_outcomes (passed = 1 )
41
50
42
51
43
52
def test_auto_mode_async_fixture (pytester : Pytester ):
53
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
44
54
pytester .makepyfile (
45
55
dedent (
46
56
"""\
@@ -65,6 +75,7 @@ async def test_a(fixture_a):
65
75
66
76
67
77
def test_auto_mode_method_fixture (pytester : Pytester ):
78
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
68
79
pytester .makepyfile (
69
80
dedent (
70
81
"""\
@@ -92,6 +103,7 @@ async def test_a(self, fixture_a):
92
103
93
104
94
105
def test_auto_mode_static_method (pytester : Pytester ):
106
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
95
107
pytester .makepyfile (
96
108
dedent (
97
109
"""\
@@ -113,6 +125,7 @@ async def test_a():
113
125
114
126
115
127
def test_auto_mode_static_method_fixture (pytester : Pytester ):
128
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
116
129
pytester .makepyfile (
117
130
dedent (
118
131
"""\
0 commit comments