(self)
| 693 | self.addfinalizer(func) |
| 694 | |
| 695 | def collect(self) -> Iterable[nodes.Item | nodes.Collector]: |
| 696 | # Always collect __init__.py first. |
| 697 | def sort_key(entry: os.DirEntry[str]) -> object: |
| 698 | return (entry.name != "__init__.py", entry.name) |
| 699 | |
| 700 | config = self.config |
| 701 | col: nodes.Collector | None |
| 702 | cols: Sequence[nodes.Collector] |
| 703 | ihook = self.ihook |
| 704 | for direntry in scandir(self.path, sort_key): |
| 705 | if direntry.is_dir(): |
| 706 | path = Path(direntry.path) |
| 707 | if not self.session.isinitpath(path, with_parents=True): |
| 708 | if ihook.pytest_ignore_collect(collection_path=path, config=config): |
| 709 | continue |
| 710 | col = ihook.pytest_collect_directory(path=path, parent=self) |
| 711 | if col is not None: |
| 712 | yield col |
| 713 | |
| 714 | elif direntry.is_file(): |
| 715 | path = Path(direntry.path) |
| 716 | if not self.session.isinitpath(path): |
| 717 | if ihook.pytest_ignore_collect(collection_path=path, config=config): |
| 718 | continue |
| 719 | cols = ihook.pytest_collect_file(file_path=path, parent=self) |
| 720 | yield from cols |
| 721 | |
| 722 | |
| 723 | def _call_with_optional_argument(func, arg) -> None: |
nothing calls this directly
no test coverage detected