Skip to content

Commit 8cc0fa5

Browse files
committed
refactor: Removed obsolete event_loop_fixture_name.
1 parent afae52f commit 8cc0fa5

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

pytest_asyncio/plugin.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,12 @@ def _preprocess_async_fixtures(
252252
or fixturedef.scope
253253
)
254254
if scope == "function":
255-
event_loop_fixture_name = "function"
256255
event_loop_fixture_id: Optional[str] = "event_loop"
257256
else:
258257
try:
259258
event_loop_node = _retrieve_scope_root(collector, scope)
260259
except Exception:
261260
continue
262-
event_loop_fixture_name = event_loop_node.name
263261
event_loop_fixture_id = event_loop_node.stash.get(
264262
# Type ignored because of non-optimal mypy inference.
265263
_event_loop_fixture_id, # type: ignore[arg-type]
@@ -288,29 +286,26 @@ def _preprocess_async_fixtures(
288286
fixturedef.argnames += ("event_loop",)
289287
_synchronize_async_fixture(
290288
fixturedef,
291-
event_loop_fixture_name,
292289
event_loop_fixture_id,
293290
)
294291
assert _is_asyncio_fixture_function(fixturedef.func)
295292
processed_fixturedefs.add((fixturedef, event_loop_fixture_id))
296293

297294

298295
def _synchronize_async_fixture(
299-
fixturedef: FixtureDef, event_loop_fixture_name: str, event_loop_fixture_id: str
296+
fixturedef: FixtureDef, event_loop_fixture_id: str
300297
) -> None:
301298
"""
302299
Wraps the fixture function of an async fixture in a synchronous function.
303300
"""
304301
if inspect.isasyncgenfunction(fixturedef.func) or getattr(
305302
fixturedef.func, "_async_fixture", False
306303
):
307-
_wrap_asyncgen_fixture(
308-
fixturedef, event_loop_fixture_name, event_loop_fixture_id
309-
)
304+
_wrap_asyncgen_fixture(fixturedef, event_loop_fixture_id)
310305
elif inspect.iscoroutinefunction(fixturedef.func) or getattr(
311306
fixturedef.func, "_async_fixture", False
312307
):
313-
_wrap_async_fixture(fixturedef, event_loop_fixture_name, event_loop_fixture_id)
308+
_wrap_async_fixture(fixturedef, event_loop_fixture_id)
314309

315310

316311
def _add_kwargs(
@@ -347,9 +342,7 @@ def _perhaps_rebind_fixture_func(
347342
return func
348343

349344

350-
def _wrap_asyncgen_fixture(
351-
fixturedef: FixtureDef, event_loop_fixture_name: str, event_loop_fixture_id: str
352-
) -> None:
345+
def _wrap_asyncgen_fixture(fixturedef: FixtureDef, event_loop_fixture_id: str) -> None:
353346
fixture = fixturedef.func
354347

355348
if getattr(fixture, "_async_fixture", False):
@@ -405,9 +398,7 @@ async def async_finalizer() -> None:
405398
fixturedef.func = _asyncgen_fixture_wrapper
406399

407400

408-
def _wrap_async_fixture(
409-
fixturedef: FixtureDef, event_loop_fixture_name: str, event_loop_fixture_id: str
410-
) -> None:
401+
def _wrap_async_fixture(fixturedef: FixtureDef, event_loop_fixture_id: str) -> None:
411402
fixture = fixturedef.func
412403

413404
if getattr(fixture, "_async_fixture", False):

0 commit comments

Comments
 (0)