Skip to content

Commit 3bcd316

Browse files
authored
test_collection.py migrate from testdir to Pytester (pytest-dev#8003)
1 parent 6a5037a commit 3bcd316

File tree

2 files changed

+376
-347
lines changed

2 files changed

+376
-347
lines changed

src/_pytest/pytester.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
from _pytest.nodes import Collector
5151
from _pytest.nodes import Item
5252
from _pytest.pathlib import make_numbered_dir
53-
from _pytest.python import Module
5453
from _pytest.reports import CollectReport
5554
from _pytest.reports import TestReport
5655
from _pytest.tmpdir import TempPathFactory
@@ -652,7 +651,7 @@ def __init__(
652651
) -> None:
653652
self._request = request
654653
self._mod_collections: WeakKeyDictionary[
655-
Module, List[Union[Item, Collector]]
654+
Collector, List[Union[Item, Collector]]
656655
] = (WeakKeyDictionary())
657656
if request.function:
658657
name: str = request.function.__name__
@@ -1244,7 +1243,7 @@ def getmodulecol(
12441243
return self.getnode(config, path)
12451244

12461245
def collect_by_name(
1247-
self, modcol: Module, name: str
1246+
self, modcol: Collector, name: str
12481247
) -> Optional[Union[Item, Collector]]:
12491248
"""Return the collection node for name from the module collection.
12501249
@@ -1639,7 +1638,7 @@ def getmodulecol(self, source, configargs=(), withinit=False):
16391638
)
16401639

16411640
def collect_by_name(
1642-
self, modcol: Module, name: str
1641+
self, modcol: Collector, name: str
16431642
) -> Optional[Union[Item, Collector]]:
16441643
"""See :meth:`Pytester.collect_by_name`."""
16451644
return self._pytester.collect_by_name(modcol, name)

0 commit comments

Comments
 (0)