Skip to main content

parse_test_failures

Function parse_test_failures 

Source
pub fn parse_test_failures(output: &str) -> Vec<String>
Expand description

Parse pytest’s short-summary FAILED lines into node ids (tests/test_x.py::test_name). Best-effort and format-tolerant: the line is FAILED <node id> - <reason>, so the second whitespace token is the id. Deduplicated, order-preserving. Anything unrecognized yields nothing — the caller treats an empty result as “learned nothing”, not “no failures”.

ERROR lines are deliberately excluded. A pytest ERROR is a collection/ setup failure — the module couldn’t even be imported (a stdlib API removed in a newer Python, a missing dep, an unsupported kwarg) — which is environment drift, never the behavioural bug the intent describes, and never what the task’s own contract targets (the extractor scopes to tests that flip fail→pass under the fix, i.e. FAILEDs). Grounding on an ERROR would import an unfixable check into the coder’s self-contract and burn its whole budget on drift it can’t resolve (the #7 false-negative). Verified live: grounding on all failures pulled test_instance_config.py’s pkgutil.get_loader collection error (gone in 3.14) into the contract; FAILED-only drops it and keeps the real AssertionError bug.