This commit is contained in:
turturica 2018-08-09 18:28:22 -07:00
parent 4d8903fd0b
commit 266f05c4c4
2 changed files with 4 additions and 3 deletions

View File

@ -505,8 +505,9 @@ class Session(nodes.FSCollector):
root = self._node_cache[pkginit]
else:
col = root._collectfile(pkginit)
if col and isinstance(col, Package):
root = col[0]
if col:
if isinstance(col[0], Package):
root = col[0]
self._node_cache[root.fspath] = root
# If it's a directory argument, recurse and look for any Subpackages.

View File

@ -647,7 +647,7 @@ class Test_getinitialnodes(object):
col = testdir.getnode(config, x)
assert isinstance(col, pytest.Module)
assert col.name == "x.py"
assert col.parent.parent is None
assert col.parent.parent.parent is None
for col in col.listchain():
assert col.config is config