Skip to content

fix(test): do not cache filtered PYTEST_ADDOPTS runs as full suite #3916

Closed

Description

@zackees

Context

The bash wrapper does not expose pytest's -k, so focused Python regression runs can be selected through PYTEST_ADDOPTS. A successful focused run with PYTEST_ADDOPTS=-k ... still satisfies test.py's current running_all_tests condition because that condition only checks parsed test/example arguments.

Reproduction:

  1. Run bash test --py --verbose with PYTEST_ADDOPTS selecting five tests.
  2. Pytest reports 5 passed, 911 deselected.
  3. test.py saves python_test.json with status success as if all 916 tests ran.
  4. Run bash test --py --verbose without PYTEST_ADDOPTS.
  5. The runner prints Fingerprint cache valid - skipping Python tests and executes nothing.

This is false green coverage: a partial pytest selection authorizes the full Python-suite cache.

Proposal

Treat any non-empty PYTEST_ADDOPTS as cache-ineligible. Bypass the Python ultra-early cache while it is set, force the Python worker to run, and never persist a full-suite fingerprint from that invocation. Whitespace-only values remain equivalent to unset.

Acceptance criteria

  • Preserve RED evidence that a focused PYTEST_ADDOPTS=-k ... run can currently produce a reusable full-suite fingerprint.
  • Non-empty PYTEST_ADDOPTS bypasses ultra-early cache reuse.
  • Non-empty PYTEST_ADDOPTS forces the Python worker to run even when the prior fingerprint is fresh.
  • A successful filtered run does not save or refresh the full Python-suite fingerprint.
  • Whitespace-only PYTEST_ADDOPTS does not disable caching.
  • Focused tests, lint, and a subsequent unfiltered Python suite pass.

Decisions

  • The guard is conservative: even harmless custom pytest options disable fingerprint reuse because the runner cannot prove they preserve suite semantics.
  • --no-fingerprint remains forbidden for normal agent workflows; this fix makes focused wrapper runs safe without that flag.
  • Severity is P1 because the current behavior can report unexecuted tests as cached green.

Related

Activity

  1. moved this from Triage to Done in FastLED Trackeron Aug 20, 2026
  2. added a commit that references this issue on Aug 20, 2026
    5910be3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions