A test is skipped or marked as an expected failure without a reason
What it finds
A skipped test that does not say why stays skipped long after the reason went away, since no one knows when it may run again. Reported are pytest.mark.skip, pytest.mark.xfail and pytest.skip() without a reason, given by position or as reason=.
From the rule's source, skip_without_reason.rs.
import pytest @pytest.mark.skiptx0 reports: this test is skipped without a reasondef test_a(): pass @pytest.mark.xfail()tx0 reports: this test is expected to fail without a reasondef test_b(): pass @pytest.mark.skip(reason="flaky on CI")def test_c(): pytest.skip()tx0 reports: this test is skipped without a reason pytest.skip("not on Windows") Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:skip-without-reason" = "note"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:skip-without-reason] reason="..."tx0 explain tx0/python:skip-without-reason shows the same in the terminal. Found a false positive? Report it.