Skip to content

Commit 11b04e0

Browse files
committed
Improved the heuristics to detect a namespace package without importing it.
1 parent 09b2492 commit 11b04e0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

_pytest/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,9 @@ def _locate_module(self, modulename, searchpath):
665665
if type_[2] != imp.PKG_DIRECTORY:
666666
return [pathname]
667667
else:
668+
init_file = os.path.join(pathname, '__init__.py')
669+
if os.path.getsize(init_file) == 0:
670+
return [pathname]
668671
return [pathname] + self._locate_module(
669672
modulename,
670673
searchpath[searchpath.index(os.path.dirname(pathname)) + 1:])

0 commit comments

Comments
 (0)