@@ -93,12 +93,12 @@ def test_conftest_funcargs_only_available_in_subdir(self, testdir):
9393 sub1 .join ("conftest.py" ).write (_pytest ._code .Source ("""
9494 import pytest
9595 def pytest_funcarg__arg1(request):
96- pytest.raises(Exception, "request.getfuncargvalue ('arg2')")
96+ pytest.raises(Exception, "request.getfixturevalue ('arg2')")
9797 """ ))
9898 sub2 .join ("conftest.py" ).write (_pytest ._code .Source ("""
9999 import pytest
100100 def pytest_funcarg__arg2(request):
101- pytest.raises(Exception, "request.getfuncargvalue ('arg1')")
101+ pytest.raises(Exception, "request.getfixturevalue ('arg1')")
102102 """ ))
103103
104104 sub1 .join ("test_in_sub1.py" ).write ("def test_1(arg1): pass" )
@@ -435,21 +435,23 @@ def test_method(self, something):
435435 assert len (arg2fixturedefs ) == 1
436436 assert arg2fixturedefs [0 ].__name__ == "pytest_funcarg__something"
437437
438- def test_getfuncargvalue_recursive (self , testdir ):
438+ def test_getfixturevalue_recursive (self , testdir ):
439439 testdir .makeconftest ("""
440440 def pytest_funcarg__something(request):
441441 return 1
442442 """ )
443443 testdir .makepyfile ("""
444444 def pytest_funcarg__something(request):
445- return request.getfuncargvalue ("something") + 1
445+ return request.getfixturevalue ("something") + 1
446446 def test_func(something):
447447 assert something == 2
448448 """ )
449449 reprec = testdir .inline_run ()
450450 reprec .assertoutcome (passed = 1 )
451451
452- def test_getfuncargvalue (self , testdir ):
452+ @pytest .mark .parametrize (
453+ 'getfixmethod' , ('getfixturevalue' , 'getfuncargvalue' ))
454+ def test_getfixturevalue (self , testdir , getfixmethod ):
453455 item = testdir .getitem ("""
454456 l = [2]
455457 def pytest_funcarg__something(request): return 1
@@ -458,14 +460,15 @@ def pytest_funcarg__other(request):
458460 def test_func(something): pass
459461 """ )
460462 req = item ._request
461- pytest .raises (FixtureLookupError , req .getfuncargvalue , "notexists" )
462- val = req .getfuncargvalue ("something" )
463+ fixture_fetcher = getattr (req , getfixmethod )
464+ pytest .raises (FixtureLookupError , fixture_fetcher , "notexists" )
465+ val = fixture_fetcher ("something" )
463466 assert val == 1
464- val = req . getfuncargvalue ("something" )
467+ val = fixture_fetcher ("something" )
465468 assert val == 1
466- val2 = req . getfuncargvalue ("other" )
469+ val2 = fixture_fetcher ("other" )
467470 assert val2 == 2
468- val2 = req . getfuncargvalue ("other" ) # see about caching
471+ val2 = fixture_fetcher ("other" ) # see about caching
469472 assert val2 == 2
470473 pytest ._fillfuncargs (item )
471474 assert item .funcargs ["something" ] == 1
@@ -798,10 +801,10 @@ def test_two_different_setups(arg1, arg2):
798801 "*1 passed*"
799802 ])
800803
801- def test_request_cached_setup_getfuncargvalue (self , testdir ):
804+ def test_request_cached_setup_getfixturevalue (self , testdir ):
802805 testdir .makepyfile ("""
803806 def pytest_funcarg__arg1(request):
804- arg1 = request.getfuncargvalue ("arg2")
807+ arg1 = request.getfixturevalue ("arg2")
805808 return request.cached_setup(lambda: arg1 + 1)
806809 def pytest_funcarg__arg2(request):
807810 return request.cached_setup(lambda: 10)
@@ -1104,7 +1107,7 @@ def test_2(arg2):
11041107
11051108class TestFixtureManagerParseFactories :
11061109 def pytest_funcarg__testdir (self , request ):
1107- testdir = request .getfuncargvalue ("testdir" )
1110+ testdir = request .getfixturevalue ("testdir" )
11081111 testdir .makeconftest ("""
11091112 def pytest_funcarg__hello(request):
11101113 return "conftest"
@@ -1790,9 +1793,9 @@ def test_4(arg, created, finalized):
17901793 reprec .assertoutcome (passed = 4 )
17911794
17921795 @pytest .mark .parametrize ("method" , [
1793- 'request.getfuncargvalue ("arg")' ,
1796+ 'request.getfixturevalue ("arg")' ,
17941797 'request.cached_setup(lambda: None, scope="function")' ,
1795- ], ids = ["getfuncargvalue " , "cached_setup" ])
1798+ ], ids = ["getfixturevalue " , "cached_setup" ])
17961799 def test_scope_mismatch_various (self , testdir , method ):
17971800 testdir .makeconftest ("""
17981801 import pytest
@@ -2723,6 +2726,7 @@ def test_1(arg1):
27232726 *def arg1*
27242727 """ )
27252728
2729+
27262730class TestParameterizedSubRequest :
27272731 def test_call_from_fixture (self , testdir ):
27282732 testfile = testdir .makepyfile ("""
@@ -2828,3 +2832,7 @@ def test_foo(request):
28282832 E*{1}:5
28292833 *1 failed*
28302834 """ .format (fixfile .strpath , testfile .basename ))
2835+
2836+
2837+ def test_getfuncargvalue_is_deprecated (request ):
2838+ pytest .deprecated_call (request .getfuncargvalue , 'tmpdir' )
0 commit comments