fixtures: remove unneeded optimization from `_getnextfixturedef`
According to my understanding, this code, which handles obtaining the relevant fixturedefs when a dynamic `getfixturevalue` is used, has an optimization where it only grabs fixturedefs that are visible to the *parent* of the item, instead of the item itself, under the assumption that a fixturedef can't be visible to a single item, only to a collector. Remove this optimization for the following reasons: - It doesn't save much (one loop iteration in `matchfactories`) - It slightly complicates the complex fixtures code - If some plugin wants to make a fixture visible only to a single item, why not let it? - In the static case (`getfixtureclosure`), this optimization is not done (despite the confusing name `parentnode`, it is *not* the parent node). This is inconsistent.
This commit is contained in:
parent
98b008ff6c
commit
686f9e0720
|
@ -413,9 +413,7 @@ class FixtureRequest(abc.ABC):
|
|||
# We arrive here because of a dynamic call to
|
||||
# getfixturevalue(argname) usage which was naturally
|
||||
# not known at parsing/collection time.
|
||||
parent = self._pyfuncitem.parent
|
||||
assert parent is not None
|
||||
fixturedefs = self._fixturemanager.getfixturedefs(argname, parent)
|
||||
fixturedefs = self._fixturemanager.getfixturedefs(argname, self._pyfuncitem)
|
||||
if fixturedefs is not None:
|
||||
self._arg2fixturedefs[argname] = fixturedefs
|
||||
# No fixtures defined with this name.
|
||||
|
|
Loading…
Reference in New Issue