Skip to content

Commit

Permalink
Merge pull request pytest-dev#12023 from bluetech/fixtures-cleanups-2
Browse files Browse the repository at this point in the history
fixtures: remove an unneeded suppress
  • Loading branch information
bluetech committed Feb 23, 2024
2 parents 93cd7ba + ad651dd commit b510adf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import abc
from collections import defaultdict
from collections import deque
from contextlib import suppress
import dataclasses
import functools
import inspect
Expand Down Expand Up @@ -578,21 +577,20 @@ def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
# (latter managed by fixturedef)
argname = fixturedef.argname
funcitem = self._pyfuncitem
scope = fixturedef._scope
try:
callspec = funcitem.callspec
except AttributeError:
callspec = None
if callspec is not None and argname in callspec.params:
param = callspec.params[argname]
param_index = callspec.indices[argname]
# If a parametrize invocation set a scope it will override
# the static scope defined with the fixture function.
with suppress(KeyError):
scope = callspec._arg2scope[argname]
# The parametrize invocation scope overrides the fixture's scope.
scope = callspec._arg2scope[argname]
else:
param = NOTSET
param_index = 0
scope = fixturedef._scope

has_params = fixturedef.params is not None
fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
if has_params and fixtures_not_supported:
Expand Down

0 comments on commit b510adf

Please sign in to comment.