Skip to content

python/test-skip

Rule test-skip
Pack Python
Severity warning
Fix none, edit by hand
Library versions every version

A skipped test never runs, so it proves nothing. Fix what makes it fail, or delete it and write down why.

@pytest.mark.skip(reason="fails on CI")
def test_total():
assert total(ORDERS) == 3.0
assert total(ORDERS) == pytest.approx(3.0)

The rule reports pytest.mark.skip and unittest.skip in a test file. It also reports pytest.mark.xfail with strict=False, which lets the test fail and the run still pass.

xpd has no automatic fix, so make the change by hand.

A skipped test stays in the suite and reports nothing, so the failure it was written to catch comes back unseen. Fix what makes the test fail. When the cause can't be found, delete the test and write down why. The rule leaves skipif alone, because it names the platform or version where the test can't run, and it leaves an xfail without strict=False alone, because strict_xfail in the project's settings decides whether it can hide a failure.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

This test never runs. Fix what makes it fail, or delete the test and write down why.

Browse the other rules of the Python pack.