MCPcopy
hub / github.com/pytest-dev/pytest / pytest_collect_file

Function pytest_collect_file

src/_pytest/doctest.py:126–138  ·  view source on GitHub ↗
(
    file_path: Path,
    parent: Collector,
)

Source from the content-addressed store, hash-verified

124
125
126def pytest_collect_file(
127 file_path: Path,
128 parent: Collector,
129) -> DoctestModule | DoctestTextfile | None:
130 config = parent.config
131 if file_path.suffix == ".py":
132 if config.option.doctestmodules and not any(
133 (_is_setup_py(file_path), _is_main_py(file_path))
134 ):
135 return DoctestModule.from_parent(parent, path=file_path)
136 elif _is_doctest(config, file_path, parent):
137 return DoctestTextfile.from_parent(parent, path=file_path)
138 return None
139
140
141def _is_setup_py(path: Path) -> bool:

Callers

nothing calls this directly

Calls 4

_is_setup_pyFunction · 0.85
_is_main_pyFunction · 0.85
_is_doctestFunction · 0.85
from_parentMethod · 0.45

Tested by

no test coverage detected