@@ -2199,14 +2199,14 @@ def test_ordering_dependencies_torndown_first(
21992199 ) -> None :
22002200 """#226"""
22012201 pytester .makepyfile (
2202- """
2202+ f """
22032203 import pytest
22042204 values = []
2205- @pytest.fixture(%( param1)s )
2205+ @pytest.fixture({ param1 } )
22062206 def arg1(request):
22072207 request.addfinalizer(lambda: values.append("fin1"))
22082208 values.append("new1")
2209- @pytest.fixture(%( param2)s )
2209+ @pytest.fixture({ param2 } )
22102210 def arg2(request, arg1):
22112211 request.addfinalizer(lambda: values.append("fin2"))
22122212 values.append("new2")
@@ -2215,8 +2215,7 @@ def test_arg(arg2):
22152215 pass
22162216 def test_check():
22172217 assert values == ["new1", "new2", "fin2", "fin1"]
2218- """ # noqa: UP031 (python syntax issues)
2219- % locals ()
2218+ """
22202219 )
22212220 reprec = pytester .inline_run ("-s" )
22222221 reprec .assertoutcome (passed = 2 )
@@ -3096,21 +3095,21 @@ def test_finalizer_order_on_parametrization(
30963095 ) -> None :
30973096 """#246"""
30983097 pytester .makepyfile (
3099- """
3098+ f """
31003099 import pytest
31013100 values = []
31023101
3103- @pytest.fixture(scope=%( scope)r , params=["1"])
3102+ @pytest.fixture(scope={ scope !r } , params=["1"])
31043103 def fix1(request):
31053104 return request.param
31063105
3107- @pytest.fixture(scope=%( scope)r )
3106+ @pytest.fixture(scope={ scope !r } )
31083107 def fix2(request, base):
31093108 def cleanup_fix2():
31103109 assert not values, "base should not have been finalized"
31113110 request.addfinalizer(cleanup_fix2)
31123111
3113- @pytest.fixture(scope=%( scope)r )
3112+ @pytest.fixture(scope={ scope !r } )
31143113 def base(request, fix1):
31153114 def cleanup_base():
31163115 values.append("fin_base")
@@ -3123,8 +3122,7 @@ def test_baz(base, fix2):
31233122 pass
31243123 def test_other():
31253124 pass
3126- """ # noqa: UP031 (python syntax issues)
3127- % {"scope" : scope }
3125+ """
31283126 )
31293127 reprec = pytester .inline_run ("-lvs" )
31303128 reprec .assertoutcome (passed = 3 )
@@ -3310,42 +3308,40 @@ class TestRequestScopeAccess:
33103308
33113309 def test_setup (self , pytester : Pytester , scope , ok , error ) -> None :
33123310 pytester .makepyfile (
3313- """
3311+ f """
33143312 import pytest
3315- @pytest.fixture(scope=%r , autouse=True)
3313+ @pytest.fixture(scope={ scope !r } , autouse=True)
33163314 def myscoped(request):
3317- for x in %r :
3315+ for x in { ok . split () } :
33183316 assert hasattr(request, x)
3319- for x in %r :
3317+ for x in { error . split () } :
33203318 pytest.raises(AttributeError, lambda:
33213319 getattr(request, x))
33223320 assert request.session
33233321 assert request.config
33243322 def test_func():
33253323 pass
3326- """ # noqa: UP031 (python syntax issues)
3327- % (scope , ok .split (), error .split ())
3324+ """
33283325 )
33293326 reprec = pytester .inline_run ("-l" )
33303327 reprec .assertoutcome (passed = 1 )
33313328
33323329 def test_funcarg (self , pytester : Pytester , scope , ok , error ) -> None :
33333330 pytester .makepyfile (
3334- """
3331+ f """
33353332 import pytest
3336- @pytest.fixture(scope=%r )
3333+ @pytest.fixture(scope={ scope !r } )
33373334 def arg(request):
3338- for x in %r :
3335+ for x in { ok . split ()!r } :
33393336 assert hasattr(request, x)
3340- for x in %r :
3337+ for x in { error . split ()!r } :
33413338 pytest.raises(AttributeError, lambda:
33423339 getattr(request, x))
33433340 assert request.session
33443341 assert request.config
33453342 def test_func(arg):
33463343 pass
3347- """ # noqa: UP031 (python syntax issues)
3348- % (scope , ok .split (), error .split ())
3344+ """
33493345 )
33503346 reprec = pytester .inline_run ()
33513347 reprec .assertoutcome (passed = 1 )
0 commit comments