Skip to content

Commit 6d90421

Browse files
chore: skipping tests: migrate to f-strings
1 parent 48721e1 commit 6d90421

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

testing/test_skipping.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -602,13 +602,12 @@ def test_xfail_raises(
602602
self, expected, actual, matchline, pytester: Pytester
603603
) -> None:
604604
p = pytester.makepyfile(
605-
"""
605+
f"""
606606
import pytest
607-
@pytest.mark.xfail(raises=%s)
607+
@pytest.mark.xfail(raises={expected})
608608
def test_raises():
609-
raise %s()
610-
""" # noqa: UP031 (python syntax issues)
611-
% (expected, actual)
609+
raise {actual}()
610+
"""
612611
)
613612
result = pytester.runpytest(p)
614613
result.stdout.fnmatch_lines([matchline])
@@ -900,13 +899,12 @@ def test_func():
900899
)
901900
def test_skipif_reporting(self, pytester: Pytester, params) -> None:
902901
p = pytester.makepyfile(
903-
test_foo="""
902+
test_foo=f"""
904903
import pytest
905-
@pytest.mark.skipif(%(params)s)
904+
@pytest.mark.skipif({params})
906905
def test_that():
907906
assert 0
908-
""" # noqa: UP031 (python syntax issues)
909-
% dict(params=params)
907+
"""
910908
)
911909
result = pytester.runpytest(p, "-s", "-rs")
912910
result.stdout.fnmatch_lines(["*SKIP*1*test_foo.py*platform*", "*1 skipped*"])

0 commit comments

Comments
 (0)