main: only perform one recursive matchnodes call per node
This commit is contained in:
parent
0c6b2f39b2
commit
841521fedb
|
@ -764,15 +764,16 @@ class Session(nodes.FSCollector):
|
||||||
rep = collect_one_node(node)
|
rep = collect_one_node(node)
|
||||||
self._collection_node_cache3[key] = rep
|
self._collection_node_cache3[key] = rep
|
||||||
if rep.passed:
|
if rep.passed:
|
||||||
has_matched = False
|
submatching = []
|
||||||
for x in rep.result:
|
for x in rep.result:
|
||||||
# TODO: Remove parametrized workaround once collection structure contains parametrization.
|
# TODO: Remove parametrized workaround once collection structure contains parametrization.
|
||||||
if x.name == names[0] or x.name.split("[")[0] == names[0]:
|
if x.name == names[0] or x.name.split("[")[0] == names[0]:
|
||||||
result.extend(self.matchnodes([x], names[1:]))
|
submatching.append(x)
|
||||||
has_matched = True
|
if submatching:
|
||||||
|
result.extend(self.matchnodes(submatching, names[1:]))
|
||||||
# XXX Accept IDs that don't have "()" for class instances.
|
# XXX Accept IDs that don't have "()" for class instances.
|
||||||
if not has_matched and len(rep.result) == 1 and x.name == "()":
|
elif len(rep.result) == 1 and rep.result[0].name == "()":
|
||||||
result.extend(self.matchnodes([x], names))
|
result.extend(self.matchnodes(rep.result, names))
|
||||||
else:
|
else:
|
||||||
# Report collection failures here to avoid failing to run some test
|
# Report collection failures here to avoid failing to run some test
|
||||||
# specified in the command line because the module could not be
|
# specified in the command line because the module could not be
|
||||||
|
|
Loading…
Reference in New Issue