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] root = self._node_cache[pkginit]
else: else:
col = root._collectfile(pkginit) col = root._collectfile(pkginit)
if col and isinstance(col, Package): if col:
root = col[0] if isinstance(col[0], Package):
root = col[0]
self._node_cache[root.fspath] = root self._node_cache[root.fspath] = root
# If it's a directory argument, recurse and look for any Subpackages. # 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) col = testdir.getnode(config, x)
assert isinstance(col, pytest.Module) assert isinstance(col, pytest.Module)
assert col.name == "x.py" assert col.name == "x.py"
assert col.parent.parent is None assert col.parent.parent.parent is None
for col in col.listchain(): for col in col.listchain():
assert col.config is config assert col.config is config