Skip to content

Deleted, skipped, focused (.only), exited (sys.exit(0)) or force-passed tests ​

Tests and verification: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as weakened-tests.

What makes deleted, skipped or force-passed tests a bad practice? ​

The standards that call it a bad practice: Clean Code T4 (an ignored test is a question); GitHub's AGENTS.md guidance: never remove a failing test.

What does lessloc do about deleted, skipped or force-passed tests? ​

lessloc catches it as weakened-tests. Skips that depend on the environment are allowed.

  • weakened-tests (tier 0): Test assertions or tests removed, or tests newly skipped, focused or forced to pass. Tier 0 in a session; check, where a person may remove a test on purpose, reports it at tier 1.

Examples ​

Caught as weakened-tests:

python
import pytest


def test_pay():
    pytest.skip("flaky")
    assert pay(2) == 2

Written well:

python
def test_pay():
    assert pay(2) == 2

The other patterns in Tests and verification:

Released under the Apache-2.0 license. · llms.txt