Repository navigation
junitxml: build testcases per item instead of per phase - #15456
Draft
RonnyPfannschmidt wants to merge 4 commits into
Draft
RonnyPfannschmidt wants to merge 4 commits into
RonnyPfannschmidt wants to merge 4 commits into
Conversation
The file attribute (xunit1/legacy families) came from Item.location, which uses os.sep, so reports produced on Windows contained backslashes while the nodeid uses '/'. Normalize to nodes.SEP in junitxml only, so terminal output is unchanged. Fixes #15453
Buffer the setup/call/teardown reports of each item and write its testcase element(s) once the teardown report arrives, so output and counts are decided with the whole item's outcome known. - file comes from the nodeid (collected module, "/" separators), line is 1-based and omitted for tests defined in another module - captured output is written once per testcase element - tests= counts testcase elements; drops open_reports and cnt_double_fail_tests - subtests become their own testcase elements - property and attribute names are escaped like values Closes #9388, closes #13876. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014GZsREjtdSBFcX2NKmt35c
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014GZsREjtdSBFcX2NKmt35c
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014GZsREjtdSBFcX2NKmt35c
|
Thanks, Ronny. If you decide to port tests from #15236, I’d suggest keeping two regressions: the fixture and unittest subtest comparison and the JUnit XML counts with two xdist workers. If you reuse those tests, I’d appreciate the |
This branch has not been deployed
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.
Requested by Ronny · project thread
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.
junitxml decided what to write per phase report, so every edge case grew another flag (
open_reports,cnt_double_fail_tests, and the ones proposed in #15196, #15357, #15236). This buffers each item's reports and builds its testcase element(s) at teardown. As a resultfilecomes from the nodeid,lineis 1-based, output is written once per element,tests=counts elements, subtests get their own testcases, and property names are escaped. Includes #15454's commit.Closes #9388, closes #13876. Covers #15453 and the junitxml cases of #15196 and #15397.
Trade-offs
lineswitches from 0-based to 1-based (breaking for xunit1/legacy consumers that compensated).junit_log_passing_tests=False.Open decisions
[subtest N] <description>, or the description only?linefor inherited tests: omit it (current), or keep the line in the defining module?Generated by Claude Code