fixtures: use early return in `_get_active_fixturedef`
This commit is contained in:
parent
d208c1d4a5
commit
530be28575
|
@ -570,7 +570,10 @@ class FixtureRequest(abc.ABC):
|
|||
self, argname: str
|
||||
) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
|
||||
fixturedef = self._fixture_defs.get(argname)
|
||||
if fixturedef is None:
|
||||
if fixturedef is not None:
|
||||
self._check_scope(fixturedef, fixturedef._scope)
|
||||
return fixturedef
|
||||
|
||||
try:
|
||||
fixturedef = self._getnextfixturedef(argname)
|
||||
except FixtureLookupError:
|
||||
|
@ -578,10 +581,10 @@ class FixtureRequest(abc.ABC):
|
|||
cached_result = (self, [0], None)
|
||||
return PseudoFixtureDef(cached_result, Scope.Function)
|
||||
raise
|
||||
|
||||
self._compute_fixture_value(fixturedef)
|
||||
|
||||
self._fixture_defs[argname] = fixturedef
|
||||
else:
|
||||
self._check_scope(fixturedef, fixturedef._scope)
|
||||
return fixturedef
|
||||
|
||||
def _get_fixturestack(self) -> List["FixtureDef[Any]"]:
|
||||
|
|
Loading…
Reference in New Issue