SKY-L041 · Logic and resilience
Empty test body
A collected test whose body is only a docstring, pass or .... Its name promises a check that was never written.
- Languages
- Python
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
pytest reports the empty test as passed, so the suite looks complete. Generated test files often contain a row of such stubs, and nobody notices that refunds were never tested.
What Skylos flags
def test_refund_restores_stock(): """Refunding an order puts its items back in stock.""" passWhat Skylos leaves alone
import pytest @pytest.mark.skip(reason="needs the warehouse stub")def test_refund_restores_stock(): """Refunding an order puts its items back in stock.""" passWhy Skylos leaves it alone
The test is marked skip with a reason, so pytest reports it as skipped rather than passed and the gap shows up in every test run. Skylos leaves skipped and xfail tests alone.
How Skylos decides
- Runs with
--qualityon Python test files that pytest would collect under the project's settings (test_*.pyand*_test.pyby default) and on provenunittest.TestCaseclasses. Skipped andxfailtests,conftest.pyand fixture folders are left out. - Reports a test whose body, after an optional docstring, holds only
passor.... - Skips a test that takes parameters (fixtures can carry the checks), and every test in a file or class where fixtures could do the checking: a
usefixturesmark, anautousefixture in the module, a setup or teardown hook such assetUp,setup_methodorsetup_module, or aconftest.pyin the test's folder or above. - Reports LOW on the
defline.
How to fix it
Write the check the name describes, or delete the stub. If it must wait, mark it skip with a reason, as in the example Skylos leaves alone.
Added: from shop.orders import place_order, refundAdded: from shop.stock import stock_levelAdded: Added: def test_refund_restores_stock(): """Refunding an order puts its items back in stock."""Removed: passAdded: order = place_order(sku="MUG-1", quantity=2)Added: refund(order)Added: assert stock_level("MUG-1") == 10When it can be wrong
- A test that exists only to prove a module imports cleanly is reported when its body is
pass. A plainimportat the top of the file already does that. - It misses stubs that take a fixture parameter, since the fixture may hold the real checks.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Put the marker on the
defline.Python def test_refund_restores_stock(): # skylos: ignore[SKY-L041] placeholder[tool.skylos] ignore = ["SKY-L041"]turns the rule off for the project.