-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Make pycobertura branch-aware and count partially hit branches as missed #168
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @aconrad
Thanks heaps for working on a prototype so quickly ⭐
I had a look at your example of the Java report, then checked out this branch and tested on my current Python project. It appears to be showing a lot more lines missing 🙂
Are you planning to add both line & branch coverage? I think the pytest-cov
HTML report shows both the old stmts/missing, as well as branches/covered.
Thanks!
`coverage.xml` is listed in `.gitignore`
I agree some may use it that way. For me, I would like to know among the missing/not-covered code if there is any that's missing branch coverage.
That won't be helpful in my case, I think. At the moment I get the Markdown report of pycobertura and post it to the GitHub REST API to create a comment on pull requests in this private repository. I don't believe the yellow color will be displayed in these comments. So without having the different color, if I understand correctly, the only difference after upgrading to this version of pycobertura would be a change in the missing column, but engineers wouldn't be able to tell (in our case) whether that's because of missing branch coverage or not. I hope that makes sense.
👍 Thanks! |
I agree that the color doesn't work everywhere since not all reports produce color. We should have another indicator to let users know that a line is partially covered. What if we annotated the missing line with a special symbol? In English, the tilde is informally used to mean "approximate", or "about", or "around" (e.g. it will take ~5 minutes to cook). Since the coverage is only approximate for partially covered lines, we could have |
The XML file doesn't account for branch rate and has to be computed differently.
@kinow Here's a sample output in markdown using the tilde
|
I think I still miss being able to see how much is branch-covered or not. I can see the numbers for line coverage (stmts / miss), but not branch (branch / partial). For others that might not be an issue, so if you prefer to keep it that way I think it's OK. For our setup I will probably keep using htmlq + pandoc to have the same information we have in pytest-cov (which I think might be fine, you don't need to modify pycobertura to be 100% equal to pytest-cov 🙂 ) Thanks |
Okay. Can you elaborate more on how the counts of branches and partials are useful to you and your team? I might not fully understand the context in which you use this information. |
I've tested this PR on one of my projects and it looks good to me. |
Addresses #167.
Now that partially hit branches are marked as missed, pycobertura might pick up more missing lines if the XML report contains branching data. Here is an example of the same XML file with branching data before and after the change:
Before
After
Note that the number of missed lines also goes up. If the branch is covered at 50%, then we just say it's missing.