Skip to content

ci: stop discarding the exit status of five checks - #7

Open
SuperInstance wants to merge 1 commit into
mainfrom
fix/ci-stop-swallowing-test-failures
Open

SuperInstance wants to merge 1 commit into
mainfrom
fix/ci-stop-swallowing-test-failures

Conversation

@SuperInstance

Copy link
Copy Markdown
Owner

.github/workflows/ci-rust-python.yml is byte-identical across 15 repos and swallowed
the exit status of every command in it that exists to prove something:

- run: cargo fmt --check || true                      # line 19
- run: cargo clippy -- -D warnings || true            # line 23
- run: cargo test --verbose || true                   # line 25
- run: flake8 . --count … --statistics || true        # line 43
- run: python -m pytest -x -v || true                 # line 45

The census recorded only lines 25 and 45 for these 15 repos (it scoped to test commands).
The same template also silences fmt, clippy and flake8 — 75 swallowed statuses across
the 15, not the 30 reported.

This repo: Cargo.toml present, 36 files containing #[test]. A tests/ directory with 9 files, none matched by test_*.py.

python -m pytest -x -v is the sharp one. pytest exits 5 (NO_TESTS_COLLECTED) when
it collects nothing — a distinguished, non-zero status that exists precisely so "no suite
ran" is not confused with "the suite passed". || true rewrote that 5 into a 0.

Removing the suffix lets the status propagate.

Expect this to go red, and that is the point. 14 of these 15 repos have no Python test
at all, so the python job has been green over a suite that does not exist. The options
from here are to write tests or to narrow the job to what the repo actually has — both are
the owner's call, and neither is something to decide by swallowing the exit code.

I could not execute cargo/flake8/pytest in my sandbox (no Rust toolchain, no PyPI
access), so the CI run on this PR is the verification. The YAML is parse-checked.

This workflow is byte-identical in 15 repos and swallowed the exit status
of every command that exists to prove something:

  cargo fmt --check || true
  cargo clippy -- -D warnings || true
  cargo test --verbose || true
  flake8 . --count --select=E9,F63,F7,F82 --statistics || true
  python -m pytest -x -v || true

For this repo: Cargo.toml present: yes, Python test files: 0.

`python -m pytest -x -v` is the sharp one. pytest exits 5
(NO_TESTS_COLLECTED) when it collects nothing -- a distinguished
non-zero status that exists precisely so "no suite ran" is not confused
with "the suite passed". `|| true` rewrote that 5 to 0.

Removing the suffix lets the status propagate. If a job goes red, it is
reporting the truth.
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