Repository navigation
Conversation
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.
Problem
Related to #141. Loading a report and reading an existing suite duration already preserves the producer's value. The remaining problem is an ordinary read of a missing numeric summary field:
report.tests, for example, callsupdate_statistics()on the live tree and replaces descendant durations.With a suite annotated
time="10"and two parallel testcases with times 8 and 9, readingreport.testschanges the suite time to 17. Writing the document then persists that unintended change.Change
Calculate missing attributes on a shallow wrapper copy with an independent XML subtree, then copy only attributes absent from the original root. Supplied XML values and descendant annotations remain unchanged. Copying all missing calculated root attributes also preserves custom descriptor metadata.
Explicit
update_statistics()and testcase mutation methods still recalculate as before. A missing root duration still uses accumulated testcase time (17 in this example), not inferred wall-clock time. This does not implement the separate accumulated-time API discussed in #141.Validation
Python 3.12.14 on Linux, synthetic fixtures only:
The lxml run skips a Windows-only path test (its existing skip message says "lxml not installed") and the stdlib-only backend assertion. The ElementTree run additionally skips the lxml-specific parser case. Hosted CI has not yet been observed.
Tradeoff
Lazy calculation now copies the XML subtree once when summary fields are missing. A single synthetic 100,000-case measurement was 0.388s before vs 0.496s after, with peak RSS 75,776 vs 138,644 KiB (about 61.4 MiB extra). This is not a stable benchmark, and large reports can incur material extra memory. A pure statistics calculator could avoid that copy but would be a broader refactor.
AI-assisted implementation and independent automated review; no claim of human review.