(self)
| 726 | return ihook.pytest_collect_file(file_path=fspath, parent=self) # type: ignore[no-any-return] |
| 727 | |
| 728 | def collect(self) -> Iterable[Union[nodes.Item, nodes.Collector]]: |
| 729 | this_path = self.path.parent |
| 730 | init_module = this_path / "__init__.py" |
| 731 | if init_module.is_file() and path_matches_patterns( |
| 732 | init_module, self.config.getini("python_files") |
| 733 | ): |
| 734 | yield Module.from_parent(self, path=init_module) |
| 735 | pkg_prefixes: Set[Path] = set() |
| 736 | for direntry in visit(str(this_path), recurse=self._recurse): |
| 737 | path = Path(direntry.path) |
| 738 | |
| 739 | # We will visit our own __init__.py file, in which case we skip it. |
| 740 | if direntry.is_file(): |
| 741 | if direntry.name == "__init__.py" and path.parent == this_path: |
| 742 | continue |
| 743 | |
| 744 | parts_ = parts(direntry.path) |
| 745 | if any( |
| 746 | str(pkg_prefix) in parts_ and pkg_prefix / "__init__.py" != path |
| 747 | for pkg_prefix in pkg_prefixes |
| 748 | ): |
| 749 | continue |
| 750 | |
| 751 | if direntry.is_file(): |
| 752 | yield from self._collectfile(path) |
| 753 | elif not direntry.is_dir(): |
| 754 | # Broken symlink or invalid/missing file. |
| 755 | continue |
| 756 | elif path.joinpath("__init__.py").is_file(): |
| 757 | pkg_prefixes.add(path) |
| 758 | |
| 759 | |
| 760 | def _call_with_optional_argument(func, arg) -> None: |
nothing calls this directly
no test coverage detected