4
4
5
5
6
6
def test_asyncio_mark_provides_function_scoped_loop_strict_mode (pytester : Pytester ):
7
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
7
8
pytester .makepyfile (
8
9
dedent (
9
10
"""\
@@ -29,6 +30,7 @@ async def test_does_not_run_in_same_loop():
29
30
30
31
31
32
def test_loop_scope_function_provides_function_scoped_event_loop (pytester : Pytester ):
33
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
32
34
pytester .makepyfile (
33
35
dedent (
34
36
"""\
@@ -54,6 +56,7 @@ async def test_does_not_run_in_same_loop():
54
56
55
57
56
58
def test_raises_when_scope_and_loop_scope_arguments_are_present (pytester : Pytester ):
59
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
57
60
pytester .makepyfile (
58
61
dedent (
59
62
"""\
@@ -70,6 +73,7 @@ async def test_raises():
70
73
71
74
72
75
def test_warns_when_scope_argument_is_present (pytester : Pytester ):
76
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
73
77
pytester .makepyfile (
74
78
dedent (
75
79
"""\
@@ -89,6 +93,7 @@ async def test_warns():
89
93
def test_function_scope_supports_explicit_event_loop_fixture_request (
90
94
pytester : Pytester ,
91
95
):
96
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
92
97
pytester .makepyfile (
93
98
dedent (
94
99
"""\
@@ -111,6 +116,7 @@ async def test_remember_loop(event_loop):
111
116
def test_asyncio_mark_respects_the_loop_policy (
112
117
pytester : Pytester ,
113
118
):
119
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
114
120
pytester .makepyfile (
115
121
dedent (
116
122
"""\
@@ -141,6 +147,7 @@ async def test_uses_custom_event_loop_policy():
141
147
def test_asyncio_mark_respects_parametrized_loop_policies (
142
148
pytester : Pytester ,
143
149
):
150
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
144
151
pytester .makepyfile (
145
152
dedent (
146
153
"""\
@@ -178,6 +185,7 @@ async def test_parametrized_loop():
178
185
def test_asyncio_mark_provides_function_scoped_loop_to_fixtures (
179
186
pytester : Pytester ,
180
187
):
188
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
181
189
pytester .makepyfile (
182
190
dedent (
183
191
"""\
@@ -208,6 +216,7 @@ async def test_runs_is_same_loop_as_fixture(my_fixture):
208
216
def test_asyncio_mark_handles_missing_event_loop_triggered_by_fixture (
209
217
pytester : Pytester ,
210
218
):
219
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
211
220
pytester .makepyfile (
212
221
dedent (
213
222
"""\
@@ -242,6 +251,7 @@ async def test_does_not_fail(sets_event_loop_to_none, n):
242
251
def test_standalone_test_does_not_trigger_warning_about_no_current_event_loop_being_set (
243
252
pytester : Pytester ,
244
253
):
254
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
245
255
pytester .makepyfile (
246
256
dedent (
247
257
"""\
@@ -260,6 +270,7 @@ async def test_anything():
260
270
def test_asyncio_mark_does_not_duplicate_other_marks_in_auto_mode (
261
271
pytester : Pytester ,
262
272
):
273
+ pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
263
274
pytester .makeconftest (
264
275
dedent (
265
276
"""\
0 commit comments