Skip to content

Commit 41818e3

Browse files
committed
refactor: Removed obsolete function _retrieve_scope_root
1 parent 491df4e commit 41818e3

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

pytest_asyncio/plugin.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import pytest
3636
from _pytest.scope import Scope
3737
from pytest import (
38-
Class,
3938
Collector,
4039
Config,
4140
FixtureDef,
@@ -44,13 +43,10 @@
4443
Item,
4544
Mark,
4645
Metafunc,
47-
Module,
48-
Package,
4946
Parser,
5047
PytestCollectionWarning,
5148
PytestDeprecationWarning,
5249
PytestPluginManager,
53-
Session,
5450
)
5551

5652
if sys.version_info >= (3, 10):
@@ -832,25 +828,6 @@ def _get_default_test_loop_scope(config: Config) -> _ScopeName:
832828
return config.getini("asyncio_default_test_loop_scope")
833829

834830

835-
def _retrieve_scope_root(item: Collector | Item, scope: str) -> Collector:
836-
node_type_by_scope = {
837-
"class": Class,
838-
"module": Module,
839-
"package": Package,
840-
"session": Session,
841-
}
842-
scope_root_type = node_type_by_scope[scope]
843-
for node in reversed(item.listchain()):
844-
if isinstance(node, scope_root_type):
845-
assert isinstance(node, pytest.Collector)
846-
return node
847-
error_message = (
848-
f"{item.name} is marked to be run in an event loop with scope {scope}, "
849-
f"but is not part of any {scope}."
850-
)
851-
raise pytest.UsageError(error_message)
852-
853-
854831
def _create_scoped_event_loop_fixture(scope: _ScopeName) -> Callable:
855832
@pytest.fixture(
856833
scope=scope,

0 commit comments

Comments
 (0)