fixtures: avoid using the mildly expensive `fixturenames` property
Avoid creating a list copy + 2 sets + a linear search through the list (in the common case).
This commit is contained in:
parent
b8906b29a7
commit
574e0f45d9
|
@ -791,7 +791,10 @@ class SubRequest(FixtureRequest):
|
|||
# If the executing fixturedef was not explicitly requested in the argument list (via
|
||||
# getfixturevalue inside the fixture call) then ensure this fixture def will be finished
|
||||
# first.
|
||||
if fixturedef.argname not in self.fixturenames:
|
||||
if (
|
||||
fixturedef.argname not in self._fixture_defs
|
||||
and fixturedef.argname not in self._pyfuncitem.fixturenames
|
||||
):
|
||||
fixturedef.addfinalizer(
|
||||
functools.partial(self._fixturedef.finish, request=self)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue