5656from _pytest .deprecated import MARKED_FIXTURE
5757from _pytest .deprecated import YIELD_FIXTURE
5858from _pytest .main import Session
59- from _pytest .mark import Mark
6059from _pytest .mark import ParameterSet
6160from _pytest .mark .structures import MarkDecorator
6261from _pytest .outcomes import fail
@@ -346,11 +345,6 @@ def prune_dependency_tree(self) -> None:
346345 working_set = set (self .initialnames )
347346 while working_set :
348347 argname = working_set .pop ()
349- # Argname may be something not included in the original names_closure,
350- # in which case we ignore it. This currently happens with pseudo
351- # FixtureDefs which wrap 'get_direct_param_fixture_func(request)'.
352- # So they introduce the new dependency 'request' which might have
353- # been missing in the original tree (closure).
354348 if argname not in closure and argname in self .names_closure :
355349 closure .add (argname )
356350 if argname in self .name2fixturedefs :
@@ -1695,26 +1689,9 @@ def sort_by_scope(arg_name: str) -> Scope:
16951689
16961690 def pytest_generate_tests (self , metafunc : Metafunc ) -> None :
16971691 """Generate new tests based on parametrized fixtures used by the given metafunc"""
1698-
1699- def get_parametrize_mark_argnames (mark : Mark ) -> Sequence [str ]:
1700- args , _ = ParameterSet ._parse_parametrize_args (* mark .args , ** mark .kwargs )
1701- return args
1702-
17031692 for argname in metafunc .fixturenames :
17041693 # Get the FixtureDefs for the argname.
1705- fixture_defs = metafunc ._arg2fixturedefs .get (argname )
1706- if not fixture_defs :
1707- # Will raise FixtureLookupError at setup time if not parametrized somewhere
1708- # else (e.g @pytest.mark.parametrize)
1709- continue
1710-
1711- # If the test itself parametrizes using this argname, give it
1712- # precedence.
1713- if any (
1714- argname in get_parametrize_mark_argnames (mark )
1715- for mark in metafunc .definition .iter_markers ("parametrize" )
1716- ):
1717- continue
1694+ fixture_defs = metafunc ._arg2fixturedefs .get (argname , ())
17181695
17191696 # In the common case we only look at the fixture def with the
17201697 # closest scope (last in the list). But if the fixture overrides
@@ -1733,6 +1710,10 @@ def get_parametrize_mark_argnames(mark: Mark) -> Sequence[str]:
17331710 break
17341711
17351712 # Not requesting the overridden super fixture, stop.
1713+ #
1714+ # TODO: Handle the case where the super-fixture is transitively
1715+ # requested (see #7737 and the xfail'd test
1716+ # test_override_parametrized_fixture_via_transitive_fixture).
17361717 if argname not in fixturedef .argnames :
17371718 break
17381719
0 commit comments