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

Method _collectfile

src/_pytest/main.py:567–589  ·  view source on GitHub ↗
(
        self, fspath: Path, handle_dupes: bool = True
    )

Source from the content-addressed store, hash-verified

565 return True
566
567 def _collectfile(
568 self, fspath: Path, handle_dupes: bool = True
569 ) -> Sequence[nodes.Collector]:
570 assert (
571 fspath.is_file()
572 ), "{!r} is not a file (isdir={!r}, exists={!r}, islink={!r})".format(
573 fspath, fspath.is_dir(), fspath.exists(), fspath.is_symlink()
574 )
575 ihook = self.gethookproxy(fspath)
576 if not self.isinitpath(fspath):
577 if ihook.pytest_ignore_collect(collection_path=fspath, config=self.config):
578 return ()
579
580 if handle_dupes:
581 keepduplicates = self.config.getoption("keepduplicates")
582 if not keepduplicates:
583 duplicate_paths = self.config.pluginmanager._duplicatepaths
584 if fspath in duplicate_paths:
585 return ()
586 else:
587 duplicate_paths.add(fspath)
588
589 return ihook.pytest_collect_file(file_path=fspath, parent=self) # type: ignore[no-any-return]
590
591 @overload
592 def perform_collect(

Callers 1

collectMethod · 0.95

Calls 5

gethookproxyMethod · 0.95
isinitpathMethod · 0.95
pytest_collect_fileMethod · 0.80
formatMethod · 0.45
getoptionMethod · 0.45

Tested by

no test coverage detected