main: inline Session._matchnodes() into Session.matchnodes()
Similar to the previous commit, this makes things more straightforward.
This commit is contained in:
parent
d121d7c917
commit
32edc4655c
|
@ -709,19 +709,10 @@ class Session(nodes.FSCollector):
|
|||
) -> Sequence[Union[nodes.Item, nodes.Collector]]:
|
||||
self.trace("matchnodes", matching, names)
|
||||
self.trace.root.indent += 1
|
||||
nodes = self._matchnodes(matching, names)
|
||||
num = len(nodes)
|
||||
self.trace("matchnodes finished -> ", num, "nodes")
|
||||
self.trace.root.indent -= 1
|
||||
if num == 0:
|
||||
raise NoMatch(matching, names[:1])
|
||||
return nodes
|
||||
|
||||
def _matchnodes(
|
||||
self, matching: Sequence[Union[nodes.Item, nodes.Collector]], names: List[str],
|
||||
) -> Sequence[Union[nodes.Item, nodes.Collector]]:
|
||||
if not matching or not names:
|
||||
return matching
|
||||
result = matching
|
||||
else:
|
||||
name = names[0]
|
||||
assert name
|
||||
nextnames = names[1:]
|
||||
|
@ -754,7 +745,15 @@ class Session(nodes.FSCollector):
|
|||
# specified in the command line because the module could not be
|
||||
# imported (#134).
|
||||
node.ihook.pytest_collectreport(report=rep)
|
||||
return resultnodes
|
||||
result = resultnodes
|
||||
|
||||
self.trace("matchnodes finished -> ", len(result), "nodes")
|
||||
self.trace.root.indent -= 1
|
||||
|
||||
if not result:
|
||||
raise NoMatch(matching, names[:1])
|
||||
else:
|
||||
return result
|
||||
|
||||
def genitems(
|
||||
self, node: Union[nodes.Item, nodes.Collector]
|
||||
|
|
Loading…
Reference in New Issue