We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 519f351 commit baaa67dCopy full SHA for baaa67d
src/_pytest/python.py
@@ -745,11 +745,11 @@ def _collectfile(
745
746
def collect(self) -> Iterable[Union[nodes.Item, nodes.Collector]]:
747
this_path = self.path.parent
748
- init_module = this_path / "__init__.py"
749
- if init_module.is_file() and path_matches_patterns(
750
- init_module, self.config.getini("python_files")
751
- ):
752
- yield Module.from_parent(self, path=init_module)
+
+ # Always collect the __init__ first.
+ if path_matches_patterns(self.path, self.config.getini("python_files")):
+ yield Module.from_parent(self, path=self.path)
753
pkg_prefixes: Set[Path] = set()
754
for direntry in visit(str(this_path), recurse=self._recurse):
755
path = Path(direntry.path)
0 commit comments