Repository navigation
Conversation
📊 Automated PR Analysis
SummaryFixes two parsing bugs: pytest quiet-mode output (e.g. '25 passed in 3.92s') was not recognized as a summary line, causing incorrect 'No tests collected' results, and ripgrep single-file searches emitting 'LINE:text' without a filename were being misparsed. Adds the -H flag to rg/grep for consistent filename output and introduces a robust parse_match_line() helper. Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
Hey @siubing05, heads up that I just opened #1554 which covers the same single-file grep parser fix as the grep portion of this PR. Yours has been open longer; I didn't notice it before starting, apologies for the duplicate effort. For reviewers' context, the two approaches differ on Windows path handling:
Both fix the Linux/macOS reproducer in #1436. Whichever shape maintainers prefer, happy to defer or fold a Windows-path test fixture into this one if that's the path forward. Also no objection if you'd rather merge yours and I close #1554, your work was first. |
…rewrite Found while integrating RTK auto-rewrite into Hermes Agent's terminal plugin. pytest: quiet output (pytest -q) ends with lines like '25 passed in 3.92s' rather than '=== 5 passed ==='. The old parser only matched the ===...=== format, so summary was never captured and the fallback returned 'Pytest: No tests collected'. grep: rg can emit 'LINE:text' (no filename) for single-file searches. The old parser assumed 'file:line:text' unconditionally and corrupted the result (e.g. '271' treated as filename instead of line number). Fixes: - is_summary_line() now handles quiet-mode and 'no tests ran' patterns. - rg/grep invoked with -H to always include filename even for single-file searches. - parse_match_line() helper parses both 'file:line:text' and 'line:text' formats robustly. Regression tests added for both paths.
|
Thanks for the heads-up — no worries on the overlap. I’ve since updated this PR to cover the Windows-path issue you pointed out as well. The grep parser now handles drive-letter paths robustly, and I added regression coverage for that case in addition to the original single-file parsing fix. This PR still also includes the pytest quiet-summary fix, so at this point it covers:
Latest head is If maintainers prefer to keep everything in one place, I’m happy for this PR to stand as the combined fix. |
Summary
-Hand fix the output label typoWhy
While integrating RTK auto-rewrite into Hermes Agent, two parser edge cases showed up:
pytest -qcan end with summaries like25 passed in 3.92s,1 error in 0.20s, or2 deselected in 0.02s; the old logic mainly relied on the=== ... ===style summary and could fall back toPytest: No tests collectedsplit(':')parsing unsafeChanges
pytest
SummaryCountsparsing for passed / failed / errors / skipped / xfailed / xpassed / deselectedno tests ranlines viais_summary_line()grep
parse_match_line()to safely parsefile:line:textand fallbackline:text-Hfor bothrgandgrepValidation
cargo testcargo fmt --all --checkcargo clippy --all-targets