MCPcopy Create free account
hub / github.com/pytest-dev/pytest / pytest_collect_file

Function pytest_collect_file

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

Source from the content-addressed store, hash-verified

120
121
122def pytest_collect_file(
123 file_path: Path,
124 parent: Collector,
125) -> Optional[Union["DoctestModule", "DoctestTextfile"]]:
126 config = parent.config
127 if file_path.suffix == ".py":
128 if config.option.doctestmodules and not any(
129 (_is_setup_py(file_path), _is_main_py(file_path))
130 ):
131 mod: DoctestModule = DoctestModule.from_parent(parent, path=file_path)
132 return mod
133 elif _is_doctest(config, file_path, parent):
134 txt: DoctestTextfile = DoctestTextfile.from_parent(parent, path=file_path)
135 return txt
136 return None
137
138
139def _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