Skip to content

Commit ff41e7a

Browse files
authored
Merge pull request #7670 from bluetech/session-inline
Start simplifying collection code in Session
2 parents 1dad5c6 + c1f9756 commit ff41e7a

File tree

5 files changed

+258
-253
lines changed

5 files changed

+258
-253
lines changed

src/_pytest/doctest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from _pytest.config import Config
3333
from _pytest.config.argparsing import Parser
3434
from _pytest.fixtures import FixtureRequest
35+
from _pytest.nodes import Collector
3536
from _pytest.outcomes import OutcomeException
3637
from _pytest.pathlib import import_path
3738
from _pytest.python_api import approx
@@ -118,7 +119,7 @@ def pytest_unconfigure() -> None:
118119

119120

120121
def pytest_collect_file(
121-
path: py.path.local, parent
122+
path: py.path.local, parent: Collector,
122123
) -> Optional[Union["DoctestModule", "DoctestTextfile"]]:
123124
config = parent.config
124125
if path.ext == ".py":

src/_pytest/hookspec.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,12 @@ def pytest_ignore_collect(path: py.path.local, config: "Config") -> Optional[boo
274274
"""
275275

276276

277-
def pytest_collect_file(path: py.path.local, parent) -> "Optional[Collector]":
278-
"""Return collection Node or None for the given path.
277+
def pytest_collect_file(
278+
path: py.path.local, parent: "Collector"
279+
) -> "Optional[Collector]":
280+
"""Create a Collector for the given path, or None if not relevant.
279281
280-
Any new node needs to have the specified ``parent`` as a parent.
282+
The new node needs to have the specified ``parent`` as a parent.
281283
282284
:param py.path.local path: The path to collect.
283285
"""

0 commit comments

Comments
 (0)