File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 2
2
import abc
3
3
from collections import defaultdict
4
4
from collections import deque
5
- from contextlib import suppress
6
5
import dataclasses
7
6
import functools
8
7
import inspect
@@ -578,21 +577,20 @@ def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
578
577
# (latter managed by fixturedef)
579
578
argname = fixturedef .argname
580
579
funcitem = self ._pyfuncitem
581
- scope = fixturedef ._scope
582
580
try :
583
581
callspec = funcitem .callspec
584
582
except AttributeError :
585
583
callspec = None
586
584
if callspec is not None and argname in callspec .params :
587
585
param = callspec .params [argname ]
588
586
param_index = callspec .indices [argname ]
589
- # If a parametrize invocation set a scope it will override
590
- # the static scope defined with the fixture function.
591
- with suppress (KeyError ):
592
- scope = callspec ._arg2scope [argname ]
587
+ # The parametrize invocation scope overrides the fixture's scope.
588
+ scope = callspec ._arg2scope [argname ]
593
589
else :
594
590
param = NOTSET
595
591
param_index = 0
592
+ scope = fixturedef ._scope
593
+
596
594
has_params = fixturedef .params is not None
597
595
fixtures_not_supported = getattr (funcitem , "nofuncargs" , False )
598
596
if has_params and fixtures_not_supported :
You can’t perform that action at this time.
0 commit comments