File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -685,9 +685,12 @@ def __repr__(self) -> str:
685685
686686 def _fillfixtures (self ) -> None :
687687 item = self ._pyfuncitem
688- for argname in item .fixturenames :
689- if argname not in item .funcargs :
690- item .funcargs [argname ] = self .getfixturevalue (argname )
688+ fixturenames = getattr (item , "fixturenames" , self .fixturenames )
689+ initialnames = item ._fixtureinfo .initialnames
690+ for argname in fixturenames :
691+ value = self .getfixturevalue (argname )
692+ if argname not in item .funcargs and argname in initialnames :
693+ item .funcargs [argname ] = value
691694
692695 def addfinalizer (self , finalizer : Callable [[], object ]) -> None :
693696 self .node .addfinalizer (finalizer )
Original file line number Diff line number Diff line change 88from _pytest .config import ExitCode
99from _pytest .fixtures import TopRequest
1010from _pytest .monkeypatch import MonkeyPatch
11- from _pytest .pytester import get_public_names
1211from _pytest .pytester import Pytester
1312from _pytest .python import Function
1413
@@ -127,8 +126,7 @@ def test_funcarg_basic(self, pytester: Pytester) -> None:
127126 assert isinstance (item , Function )
128127 # Execute's item's setup, which fills fixtures.
129128 item .session ._setupstate .setup (item )
130- del item .funcargs ["request" ]
131- assert len (get_public_names (item .funcargs )) == 2
129+ assert len (item .funcargs ) == 2
132130 assert item .funcargs ["some" ] == "test_func"
133131 assert item .funcargs ["other" ] == 42
134132
@@ -840,8 +838,7 @@ def test_func(something): pass
840838 val2 = req .getfixturevalue ("other" ) # see about caching
841839 assert val2 == 2
842840 assert item .funcargs ["something" ] == 1
843- assert len (get_public_names (item .funcargs )) == 2
844- assert "request" in item .funcargs
841+ assert len (item .funcargs ) == 1
845842
846843 def test_request_addfinalizer (self , pytester : Pytester ) -> None :
847844 item = pytester .getitem (
You can’t perform that action at this time.
0 commit comments