diff options
Diffstat (limited to 'coverage/xmlreport.py')
-rw-r--r-- | coverage/xmlreport.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py index 301bc86..7837524 100644 --- a/coverage/xmlreport.py +++ b/coverage/xmlreport.py @@ -85,7 +85,12 @@ class XmlReporter(Reporter): outfile.write(self.xml_out.toprettyxml()) # Return the total percentage. - return 100.0 * (lhits_tot + bhits_tot) / (lnum_tot + bnum_tot) + denom = lnum_tot + bnum_tot + if denom == 0: + pct = 0.0 + else: + pct = 100.0 * (lhits_tot + bhits_tot) / denom + return pct def xml_file(self, cu, analysis): """Add to the XML report for a single file.""" |