XXX: revert _collect_seen_pkgdirs
This commit is contained in:
parent
fa35f650b5
commit
134b103605
|
@ -387,7 +387,6 @@ class Session(nodes.FSCollector):
|
||||||
self._initialpaths = frozenset()
|
self._initialpaths = frozenset()
|
||||||
# Keep track of any collected nodes in here, so we don't duplicate fixtures
|
# Keep track of any collected nodes in here, so we don't duplicate fixtures
|
||||||
self._node_cache = {}
|
self._node_cache = {}
|
||||||
self._collect_seen_pkgdirs = set()
|
|
||||||
|
|
||||||
self.config.pluginmanager.register(self, name="session")
|
self.config.pluginmanager.register(self, name="session")
|
||||||
|
|
||||||
|
@ -505,7 +504,6 @@ class Session(nodes.FSCollector):
|
||||||
if parent.isdir():
|
if parent.isdir():
|
||||||
pkginit = parent.join("__init__.py")
|
pkginit = parent.join("__init__.py")
|
||||||
if pkginit.isfile():
|
if pkginit.isfile():
|
||||||
self._collect_seen_pkgdirs.add(parent)
|
|
||||||
if pkginit in self._node_cache:
|
if pkginit in self._node_cache:
|
||||||
root = self._node_cache[pkginit][0]
|
root = self._node_cache[pkginit][0]
|
||||||
else:
|
else:
|
||||||
|
@ -531,12 +529,13 @@ class Session(nodes.FSCollector):
|
||||||
def filter_(f):
|
def filter_(f):
|
||||||
return f.check(file=1)
|
return f.check(file=1)
|
||||||
|
|
||||||
|
seen_dirs = set()
|
||||||
for path in argpath.visit(
|
for path in argpath.visit(
|
||||||
fil=filter_, rec=self._recurse, bf=True, sort=True
|
fil=filter_, rec=self._recurse, bf=True, sort=True
|
||||||
):
|
):
|
||||||
dirpath = path.dirpath()
|
dirpath = path.dirpath()
|
||||||
if dirpath not in self._collect_seen_pkgdirs:
|
if dirpath not in seen_dirs:
|
||||||
self._collect_seen_pkgdirs.add(dirpath)
|
seen_dirs.add(dirpath)
|
||||||
pkginit = dirpath.join("__init__.py")
|
pkginit = dirpath.join("__init__.py")
|
||||||
if pkginit.exists() and parts(pkginit.strpath).isdisjoint(paths):
|
if pkginit.exists() and parts(pkginit.strpath).isdisjoint(paths):
|
||||||
for x in root._collectfile(pkginit):
|
for x in root._collectfile(pkginit):
|
||||||
|
|
|
@ -978,6 +978,19 @@ def test_collect_init_tests(testdir):
|
||||||
"<Package *",
|
"<Package *",
|
||||||
" <Module '__init__.py'>",
|
" <Module '__init__.py'>",
|
||||||
" <Function 'test_init'>",
|
" <Function 'test_init'>",
|
||||||
|
"<Module 'tests/test_foo.py'>",
|
||||||
|
" <Function 'test_foo'>",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
# XXX: Same as before, but different order.
|
||||||
|
result = testdir.runpytest(".", "tests", "--collect-only")
|
||||||
|
result.stdout.fnmatch_lines(
|
||||||
|
[
|
||||||
|
"collected 2 items",
|
||||||
|
"<Package *",
|
||||||
|
" <Module '__init__.py'>",
|
||||||
|
" <Function 'test_init'>",
|
||||||
|
"<Package *",
|
||||||
" <Module 'test_foo.py'>",
|
" <Module 'test_foo.py'>",
|
||||||
" <Function 'test_foo'>",
|
" <Function 'test_foo'>",
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue