Repository navigation
fix(pytest): list each failing test once when the short summary repeats it - #4947
Open
starrvarse wants to merge 1 commit into
Open
starrvarse wants to merge 1 commit into
starrvarse wants to merge 1 commit into
Conversation
…ts it pytest's default `-rfE` prints a short summary line for every failure and error that already has a FAILURES/ERRORS block. The filter added those lines as extra entries, so `rtk pipe -f pytest` (and `rtk pytest -rfE`) listed each failing test twice. A summary line is now kept only when no block covers the same test, matching the node id (`a.py::TestX::test_y`) against the block header (`TestX.test_y`, `ERROR at setup of ...`). Fixes rtk-ai#4897
📊 Automated PR Analysis
SummaryFixes a bug in rtk's pytest output filter where failing/erroring tests were listed twice: once from the FAILURES/ERRORS block and again from pytest's short test summary info line. The fix matches summary lines to existing blocks by normalizing node IDs to the block header's naming convention, skipping duplicates while still allowing a test that both fails and errors (e.g., at teardown) to show both entries. Review Checklist
Linked issues: #4897 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
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.
Summary
rtk pytest/rtk pipe -f pytestlisted each failing test twice: once from its FAILURES/ERRORS block and again from pytest'sshort test summary infoline for the same test (rtk pytest / pipe -f pytest list each failing test twice (FAILURES block and short summary line) #4897).FAILED/ERRORline intofailureswithout checking for a block. The block header uses pytest's head line (test_bad,TestCart.test_total,ERROR at setup of test_query), the summary line the node id (test_f.py::TestCart::test_total), so they never matched.::becomes.) and compared with the block name, keeping FAIL and ERROR apart, so a test that fails and also errors at teardown still gets both entries. Summary lines with no block (--tb=no, or aFAILEDline whose block is missing) are listed as before.Fixes #4897
Test plan
test_filter_pytest_short_summary_does_not_repeat_blockswith a real pytest 9.2.0 fixture (plain, class method, parametrized, setup error, failure plus teardown error). Before the fix it produced 12 entries for 6 problems (cut at 10, "+2 more failures"); after the fix each one is listed once.cargo fmt --all --check,cargo clippy --workspace --all-targets(no warnings),cargo test: all unit tests pass (4609). Three integration tests fail on my machine both with and without this change, becausejqisn't installed and the tests run as root (affirmative_allow_hooks_ignore_an_inherited_host,claude_setup_survives_opencode_install_failure,opencode_plugin_survives_read_only_claude_dir).pytest test_f.py | rtk pipe -f pytestandrtk pytest -rfE test_f.pynow liststest_badonce.