Skip to content

Commit 9e377f9

Browse files
committed
refactor: pytest_runtest_setup no longer depends on a node's StashKey to retrieve the name of the scoped event loop fixture.
1 parent 667a4e4 commit 9e377f9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pytest_asyncio/plugin.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,12 +811,8 @@ def pytest_runtest_setup(item: pytest.Item) -> None:
811811
if marker is None:
812812
return
813813
default_loop_scope = _get_default_test_loop_scope(item.config)
814-
scope = _get_marked_loop_scope(marker, default_loop_scope)
815-
if scope != "function":
816-
parent_node = _retrieve_scope_root(item, scope)
817-
event_loop_fixture_id = parent_node.stash[_event_loop_fixture_id]
818-
else:
819-
event_loop_fixture_id = "_function_event_loop"
814+
loop_scope = _get_marked_loop_scope(marker, default_loop_scope)
815+
event_loop_fixture_id = f"_{loop_scope}_event_loop"
820816
fixturenames = item.fixturenames # type: ignore[attr-defined]
821817
if event_loop_fixture_id not in fixturenames:
822818
fixturenames.append(event_loop_fixture_id)

0 commit comments

Comments
 (0)