Session: collect: keep/use already parsed initialpart

Via https://github.com/blueyed/pytest/pull/42.
This commit is contained in:
Daniel Hahler 2019-11-02 10:07:54 +01:00
parent 5be3a9b5ce
commit c4a110b20a
1 changed files with 5 additions and 5 deletions

View File

@ -488,22 +488,22 @@ class Session(nodes.FSCollector):
def collect(self):
for initialpart in self._initialparts:
arg = "::".join(map(str, initialpart))
self.trace("processing argument", arg)
self.trace("processing argument", initialpart)
self.trace.root.indent += 1
try:
yield from self._collect(arg)
yield from self._collect(initialpart)
except NoMatch:
report_arg = "::".join(map(str, initialpart))
# we are inside a make_report hook so
# we cannot directly pass through the exception
self._notfound.append((arg, sys.exc_info()[1]))
self._notfound.append((report_arg, sys.exc_info()[1]))
self.trace.root.indent -= 1
def _collect(self, arg):
from _pytest.python import Package
names = self._parsearg(arg)
names = arg[:]
argpath = names.pop(0)
# Start with a Session root, and delve to argpath item (dir or file)