Subcommand to merge coverage files#200
Open
drhagen wants to merge 13 commits into
Open
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.
This implements #119 by adding the
pycobertura mergecommand. It works basically how you would expect. The command takes multiple files and loops over each one, summing the hits across all the matching lines.There is a
--outputoption that lets the user specify an output file. Otherwise, it goes to stdout like elsewhere in pycobertura.There is a
--sourceoption that takes a glob-like path to be stripped from the filenames within the XML files. I would expect something like--source '**/site-packages/'would be useful for coverage.py output.it also supports
--ignore-regex, but mainly because pycobertura supports that everywhere else. I'm not sure its that useful here.After summing, the line-rate, lines-valid, lines-covered, branch-rate, branches-valid, and branches-covered attributes are recomputed. There are other attributes in Cobertura files that I don't think anyone cares about, but this implementation tries to handle them as sensibly as it can.
1/2and1/2branches covered were disjoint or overlapping, so I take the maximum of the numerator and the maximum of the denominator.pycobertura {version}This feature was implemented using spec driven development with the assitance of AI. The spec can be found as the file deleted in the last commit. This spec was reviewed carefully by a human throughout the process. The code and tests were generated from the spec. The AI was prompted repeatedly to check the implementation against the spec, the tests against the spec, and the code style against the rest of pycobertura. Finally, I reviewed the final code and tests, making manual changes where prudent.