python: change pytest pkg/__init__.py to only collect the __init__.py Module
Previously it would collect the entire package, but this is not what users expect. Refs #3749 Fixes #8976 Fixes #9263 Fixes #9313
This commit is contained in:
@@ -736,7 +736,9 @@ class Package(Module):
|
||||
this_path = self.path.parent
|
||||
|
||||
# Always collect the __init__ first.
|
||||
if path_matches_patterns(self.path, self.config.getini("python_files")):
|
||||
if self.session.isinitpath(self.path) or path_matches_patterns(
|
||||
self.path, self.config.getini("python_files")
|
||||
):
|
||||
yield Module.from_parent(self, path=self.path)
|
||||
|
||||
pkg_prefixes: Set[Path] = set()
|
||||
|
||||
Reference in New Issue
Block a user