chore: skipping tests: migrate to f-strings
This commit is contained in:
parent
a6513d62c9
commit
812ce76298
|
@ -602,13 +602,12 @@ class TestXFail:
|
||||||
self, expected, actual, matchline, pytester: Pytester
|
self, expected, actual, matchline, pytester: Pytester
|
||||||
) -> None:
|
) -> None:
|
||||||
p = pytester.makepyfile(
|
p = pytester.makepyfile(
|
||||||
"""
|
f"""
|
||||||
import pytest
|
import pytest
|
||||||
@pytest.mark.xfail(raises=%s)
|
@pytest.mark.xfail(raises={expected})
|
||||||
def test_raises():
|
def test_raises():
|
||||||
raise %s()
|
raise {actual}()
|
||||||
""" # noqa: UP031 (python syntax issues)
|
"""
|
||||||
% (expected, actual)
|
|
||||||
)
|
)
|
||||||
result = pytester.runpytest(p)
|
result = pytester.runpytest(p)
|
||||||
result.stdout.fnmatch_lines([matchline])
|
result.stdout.fnmatch_lines([matchline])
|
||||||
|
@ -900,13 +899,12 @@ class TestSkipif:
|
||||||
)
|
)
|
||||||
def test_skipif_reporting(self, pytester: Pytester, params) -> None:
|
def test_skipif_reporting(self, pytester: Pytester, params) -> None:
|
||||||
p = pytester.makepyfile(
|
p = pytester.makepyfile(
|
||||||
test_foo="""
|
test_foo=f"""
|
||||||
import pytest
|
import pytest
|
||||||
@pytest.mark.skipif(%(params)s)
|
@pytest.mark.skipif({params})
|
||||||
def test_that():
|
def test_that():
|
||||||
assert 0
|
assert 0
|
||||||
""" # noqa: UP031 (python syntax issues)
|
"""
|
||||||
% dict(params=params)
|
|
||||||
)
|
)
|
||||||
result = pytester.runpytest(p, "-s", "-rs")
|
result = pytester.runpytest(p, "-s", "-rs")
|
||||||
result.stdout.fnmatch_lines(["*SKIP*1*test_foo.py*platform*", "*1 skipped*"])
|
result.stdout.fnmatch_lines(["*SKIP*1*test_foo.py*platform*", "*1 skipped*"])
|
||||||
|
|
Loading…
Reference in New Issue