SKY-L046 · Logic and resilience
Test result never checked
A test that ends by storing the result of a call in a variable it never reads, with no assertion anywhere. The test computes the answer and then stops before comparing it with anything.
- Languages
- Python
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
The test only proves that the call did not raise. Whatever it returned, right or wrong, the test passes. This often happens when assertions are commented out or an agent leaves a test half written.
What Skylos flags
from deadcode.scan import find_unused def test_common_name_cross_package_gets_lower_confidence(): files = { "pkg/service.py": "class MyService:\n def get(self):\n return None\n", "pkg/main.py": "data = {}\nresult = data.get('key')\n", } unused = find_unused(files)What Skylos leaves alone
import pickle from deadcode.scan import find_unused, scan_file def test_scan_result_can_be_sent_to_workers(): result = scan_file("app.py") pickle.dumps(result) def test_scan_does_not_raise_on_empty_input(): find_unused({})Why Skylos leaves it alone
The first test passes its result on (to pickle.dumps). The second does not keep the result at all, which reads as a deliberate "does not raise" check. Neither is reported.
How Skylos decides
- Runs with
--qualityon the same collected tests as SKY-L044. Looks at the test's last statement, stepping into a trailingwithblock. - Reports when that statement assigns a call's result (awaited or not) to one or more plain names, none starting with
_, that the test never reads. - Leaves the test alone when it, or a function it calls that is defined in the same file, asserts, raises, or calls a function whose name contains
assert,check,expect,verify,raises,fail,match,snapshot,should,ensure,validateorwarns. - Also left alone:
xfailtests, tests that take abenchmarkor snapshot fixture, and tests thatreturn,yieldor useglobal.
How to fix it
Assert on the stored result, or remove the assignment if the test only checks that the call does not raise.
from deadcode.scan import find_unused def test_common_name_cross_package_gets_lower_confidence(): files = { "pkg/service.py": "class MyService:\n def get(self):\n return None\n", "pkg/main.py": "data = {}\nresult = data.get('key')\n", } unused = find_unused(files)Added: assert unused["MyService.get"].confidence < 60When it can be wrong
- A test checked by a pytest plugin through a fixture name Skylos does not know is reported. Assert in the test, or suppress the line.
- It misses a result that is read once but never compared, such as
print(result).
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 assignment line.
Python unused = find_unused(files) # skylos: ignore[SKY-L046] checked by the session fixture[tool.skylos] ignore = ["SKY-L046"]turns the rule off for the project.