Skip to content

Start simplifying collection code in Session #7670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/_pytest/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from _pytest.config import Config
from _pytest.config.argparsing import Parser
from _pytest.fixtures import FixtureRequest
from _pytest.nodes import Collector
from _pytest.outcomes import OutcomeException
from _pytest.pathlib import import_path
from _pytest.python_api import approx
Expand Down Expand Up @@ -118,7 +119,7 @@ def pytest_unconfigure() -> None:


def pytest_collect_file(
path: py.path.local, parent
path: py.path.local, parent: Collector,
) -> Optional[Union["DoctestModule", "DoctestTextfile"]]:
config = parent.config
if path.ext == ".py":
Expand Down
8 changes: 5 additions & 3 deletions src/_pytest/hookspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,12 @@ def pytest_ignore_collect(path: py.path.local, config: "Config") -> Optional[boo
"""


def pytest_collect_file(path: py.path.local, parent) -> "Optional[Collector]":
"""Return collection Node or None for the given path.
def pytest_collect_file(
path: py.path.local, parent: "Collector"
) -> "Optional[Collector]":
"""Create a Collector for the given path, or None if not relevant.

Any new node needs to have the specified ``parent`` as a parent.
The new node needs to have the specified ``parent`` as a parent.

:param py.path.local path: The path to collect.
"""
Expand Down
Loading