Non test cause
non_test_cause
Name the cause of a pytest red that no test failure explains.
A run that collects tests, reports zero failed and zero errors yet
exits non-zero has a cause the counters cannot name: a coverage threshold, a
usage error, an empty collection, an interruption, an internal error, or a
plugin blowing up at session teardown. This module classifies that cause from
the exit code and the captured output alone -- no I/O, no clock, no randomness
-- so a report can explain the red without re-running pytest by hand.
NonTestCause
Bases: BaseModel
Machine-readable cause of a red no test failure accounts for.
Source code in packages/axm-audit/src/axm_audit/core/non_test_cause.py
code
instance-attribute
Stable identifier of the cause, safe to branch on.
excerpt
instance-attribute
Bounded head of the captured subprocess output backing the verdict.
summary
instance-attribute
One-line human explanation, quoting the decisive figure when there is one.
classify_non_test_cause(*, return_code, failed, errors, stdout, stderr)
Name the non-test cause of a pytest exit, or None when there is none.
Returns None for a green exit and for a red the test counters already
explain (failed or errors non-zero) -- there is nothing left to
diagnose. Otherwise the exit code is dispatched first (it is authoritative
when pytest sets it), then the captured output is pattern-matched for the
ambiguous exit 1. Classification is fail-open: an unrecognised output is
reported as unknown carrying its excerpt, never raised and never
silently dropped.