Merge remote-tracking branch 'upstream/master' into release-3.10.0

This commit is contained in:
Bruno Oliveira
2018-11-03 13:42:20 +00:00
33 changed files with 315 additions and 41 deletions

View File

@@ -559,7 +559,15 @@ class Session(nodes.FSCollector):
col = root._collectfile(argpath)
if col:
self._node_cache[argpath] = col
for y in self.matchnodes(col, names):
m = self.matchnodes(col, names)
# If __init__.py was the only file requested, then the matched node will be
# the corresponding Package, and the first yielded item will be the __init__
# Module itself, so just use that. If this special case isn't taken, then all
# the files in the package will be yielded.
if argpath.basename == "__init__.py":
yield next(m[0].collect())
return
for y in m:
yield y
def _collectfile(self, path):