fvutils / pyucis

Python API to Unified Coverage Interoperability Standard (UCIS) Data
https://fvutils.github.io/pyucis
Apache License 2.0
21 stars 12 forks source link

fixes a division by 0 issue in case if there are no coverItems in crossCoverage bins #10

Closed eyck closed 2 years ago

eyck commented 2 years ago

I use FC4SC and when reporting cross coverages it does not write items which are not hit. This leads to a division by zero exeception.

mballance commented 2 years ago

Thanks for this report as well. Here, again, could you provide an example XML database? While this fix avoids the divide by 0, I think it will likely not get the coverage percentage correct.

eyck commented 2 years ago

Actually I do not have a database for this anymore since it has been created using a buggy random stimulus (which I fixed), My problem here was that the viewer simply crashed with the 'division by zero' message... Rgd. the coverage percentage: If you do not have a cross bin, the coverage is 0%, isnt't it? And this was -to my understanding- exactly the problem here. FC4SC on writes the cross bins into the XML database which are hit. In the faulty case none have been hit so therefore the node did not have any bins.

mballance commented 2 years ago

Good point, @eyck. I'm interested in how coverage is written when, for example, a single cross bin is hit. If only hit bins are recorded, I think the code would currently report 100% coverage. That said, happy to accept this PR for now and make updates as we have more FC4SC examples.

eyck commented 2 years ago

One question though: when will this change make it to PyPi? Is there a release or do you follow continous delivery?

mballance commented 2 years ago

pyucis is setup for CI/CD, so a release is on PyPi ~5min after a new change is committed. I migrated PyUCIS from Azure to GitHub last weekend, and that introduced a slight issue with PyPi and package versions. That issue is now resolved, and the latest release on PyPi (https://pypi.org/project/pyucis/0.0.6.2526245027/) includes the changes from this PR.