Repository navigation
Evidence: parse pytest summaries from worker output - #28
Merged
Merged
Conversation
Add a small dependency-free parser that turns pytest summary lines into
structured outcomes, and wire it into observation building so the
previously always-empty `test_results` field carries entries tagged
"source": "worker_output".
Handles passed-first and failure-first orderings ("1 failed, 3 passed"),
"N error"/"N errors", skipped counts, with or without the trailing
"in Ns" timing and "=== ... ===" wrappers. Non-summary lines are
rejected (returns None) rather than guessed at. Overall status:
errored > failed > passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes part of #20, per your review: this is the focused "worker-output test-summary parsing" change, rebased on current
main, with no Hermes or policy changes and no helper scripts.What it does
src/foreman/test_summary.py: frozenPytestSummarydataclass (passed/failed/errored/skipped,total,statuswith errored > failed > passed precedence,to_dict()), plusparse_pytest_summary_line/parse_pytest_summaries."1 failed, 3 passed"— with and withoutin Nstiming and===wrappers, plus"N error(s)"and skipped counts.collected 5 items,FAILED ...lines,2 warnings in 0.12s) instead of guessing.build_observation:test_resultsnow carries structured entries tagged"source": "worker_output".PytestSummary(notTestSummary) so pytest doesn't collect it as a test class.Validation
tests/test_test_summary.pyasserting the exact parsed outcome per input — never accept-any-summary; full suite 203 passed,ruff checkclean.