aconrad / pycobertura

A code coverage diff tool for Cobertura reports
MIT License
116 stars 39 forks source link

Return None if branch-rate is absent #174

Closed starcruiseromega closed 10 months ago

starcruiseromega commented 10 months ago

If "branch-rate" isn't present in the XML, this method tries to return float(None), which raises a TypeError. I believe that branch-rate isn't required, at least by the "loose" Cobertura spec, but either way it seems more useful to be less strict.

starcruiseromega commented 10 months ago

Back to draft -- let me update the changes file first.

starcruiseromega commented 10 months ago

Ok, should be all set now, and I ran tox locally to make sure the tests are passing. Let me know if there's anything else I need to do for this change!

aconrad commented 10 months ago

Thanks, @starcruiseromega for your PR, it's must appreciated. I'm curious to know how you are using pycobertura, if you don't mind sharing. I ask because the branch rate isn't something we use as part of the command line flow, it's more here as a convenience when people use pycobertura as a library to parse coverage reports.

aconrad commented 10 months ago

v3.2.4

starcruiseromega commented 10 months ago

Hi @aconrad ! Thanks for the merge and release, and sorry for the delay answering your question. We have an internal tool that tracks code coverage, and we use pycobertura to parse out the line coverage and branch coverage from users' reports. Most of them are generated by tools like pytest, but there are a few using languages like OCaml, for which branch coverage isn't very meaningful, so they don't have it in their reports.