Skip to content

test(immune): a missing bng_cpp must fail this file, not skip it - #72

Merged
akutuva21 merged 1 commit into
mainfrom
agent/sci-immuno
Oct 1, 2026
Merged

akutuva21 merged 1 commit into
mainfrom
agent/sci-immuno

Conversation

@akutuva21

Copy link
Copy Markdown
Member

Follow-up to #68, which is merged. Found by @correctness while reviewing it; the file is mine, so this is the fix.

The defect

Every test in tests/python/test_immune_models.py checks bng_cpp's output, so bng_cpp is the subject under test, not an optional dependency. The file nonetheless gated all 22 tests on a skip:

requires_bng_cpp = pytest.mark.skipif(_bng_cpp() is None, ...)

and _require_bng_cpp() called pytest.skip() on the same condition. With the binary absent the file reported success having executed nothing: 0 passed, 0 failed, 22 skipped, exit 0. From CI that is indistinguishable from a green run.

Measured, both directions, one command each

BNG_CPP=build/cpp/bng_cpp    ->  22 passed in 0.65s, 0 skipped
BNG_CPP=/nonexistent/bng_cpp ->  22 failed in 0.41s, 0 skipped

Before this commit the second command reported 22 skipped and exit 0. The count of 22 is identical either way, which is exactly why a skip count has to be compared against expectation rather than trusted.

The change

  • _require_bng_cpp() raises AssertionError naming the path it looked for, instead of skipping.
  • The skipif decorator and all 22 @requires_bng_cpp uses are removed — they were the mechanism and are now unreachable.
  • run_model() takes the strict helper rather than asserting on an Optional.

BNG2 keeps its real skip

The two oracle-parity tests still skip when BNG2.pl is absent. That is a genuinely optional external oracle, not the subject under test. They do still require bng_cpp, since they compare its output against the oracle's.

Not affected

The 22 assertions, the five models, and the observable defect pinning they carry. This changes only what happens when the binary is missing: from quiet success to a named failure.

One file, +20/-24. No C++, no CMake. ruff clean; black clean (--target-version py39).

🤖 Generated with Claude Code

Every test in this file checks bng_cpp's output, so bng_cpp is the subject,
not an optional dependency. The file nonetheless gated all 22 tests on

    requires_bng_cpp = pytest.mark.skipif(_bng_cpp() is None, ...)

and _require_bng_cpp() called pytest.skip() on the same condition. With the
binary absent the file reported success having executed nothing: 0 passed, 0
failed, 22 skipped, exit 0. From CI that is indistinguishable from a green run.

Correctness found this while reviewing the merged PR and flagged it as a third
silent-pass mechanism keyed on the CLI binary rather than the extension; they
correctly declined to convert it because the file is mine. It is mine, so this
is the conversion.

CHANGED
  - _require_bng_cpp() now raises AssertionError naming the path it looked for,
    instead of skipping.
  - The skipif decorator and all 22 @requires_bng_cpp uses are removed; they
    were the mechanism and are now unreachable.
  - run_model() takes the strict helper rather than asserting on an Optional.

MEASURED, both directions, one command each:

    BNG_CPP=build/cpp/bng_cpp  ->  22 passed in 0.65s, 0 skipped
    BNG_CPP=/nonexistent/bng_cpp ->  22 failed in 0.41s, 0 skipped

Before this commit the second command reported 22 skipped and exit 0. The
count 22 is identical either way, which is precisely why the skip count has to
be compared against expectation rather than trusted.

BNG2 KEEPS ITS REAL SKIP. The two oracle-parity tests still skip when
BNG2.pl is absent, because that is a genuinely optional external oracle rather
than the subject under test. They do still require bng_cpp, since they compare
its output against the oracle's.

Not affected: the 22 assertions, the models, and the observable defect pinning
they carry. This changes only what happens when the binary is missing, from
quiet success to a named failure.

ruff clean; black clean (--target-version py39).
@akutuva21
akutuva21 merged commit 9f840a5 into main Oct 1, 2026
9 of 31 checks passed
@akutuva21
akutuva21 deleted the agent/sci-immuno branch October 4, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant