| 562 | return super().from_parent(parent=parent, path=path) |
| 563 | |
| 564 | def collect(self) -> Iterable[nodes.Item | nodes.Collector]: |
| 565 | config = self.config |
| 566 | col: nodes.Collector | None |
| 567 | cols: Sequence[nodes.Collector] |
| 568 | ihook = self.ihook |
| 569 | for direntry in scandir(self.path): |
| 570 | if direntry.is_dir(): |
| 571 | path = Path(direntry.path) |
| 572 | if not self.session.isinitpath(path, with_parents=True): |
| 573 | if ihook.pytest_ignore_collect(collection_path=path, config=config): |
| 574 | continue |
| 575 | col = ihook.pytest_collect_directory(path=path, parent=self) |
| 576 | if col is not None: |
| 577 | yield col |
| 578 | |
| 579 | elif direntry.is_file(): |
| 580 | path = Path(direntry.path) |
| 581 | if not self.session.isinitpath(path): |
| 582 | if ihook.pytest_ignore_collect(collection_path=path, config=config): |
| 583 | continue |
| 584 | cols = ihook.pytest_collect_file(file_path=path, parent=self) |
| 585 | yield from cols |
| 586 | |
| 587 | |
| 588 | @final |