XML reports line-rate=0 for empty files, should be 1

Issue #345 resolved
Former user created an issue

The XML report generated by coverage==3.7.1 shows that classes with no lines (typically __init__.py files) have a line-rate=0 when it should be line-rate=1.

<?xml version="1.0" ?>
<!DOCTYPE coverage
  SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
<coverage branch-rate="0" line-rate="1" timestamp="1418882048682" version="3.7.1">
    <!-- Generated by coverage.py: http://nedbatchelder.com/code/coverage -->
        <package branch-rate="0" complexity="0" line-rate="1" name="">
                <class branch-rate="0" complexity="0" filename="dummy/__init__.py" line-rate="0" name="dummy/__init__">
                <class branch-rate="0" complexity="0" filename="dummy/dummy.py" line-rate="1" name="dummy/dummy">
                        <line hits="1" number="1"/>
                        <line hits="1" number="2"/>
                        <line hits="1" number="4"/>
                        <line hits="1" number="5"/>
                <class branch-rate="0" complexity="0" filename="dummy/dummy2.py" line-rate="1" name="dummy/dummy2">
                        <line hits="1" number="1"/>
                        <line hits="1" number="2"/>

When this file is given to pycobertura, it shows:

$ pycobertura show coverage.xml
Name              Stmts    Miss  Cover    Missing
--------------  -------  ------  -------  ---------
dummy/__init__        0       0  0.00%
dummy/dummy           4       0  100.00%
dummy/dummy2          2       0  100.00%
TOTAL                 6       0  100.00%

Comments (4)

  1. Alexandre Conrad

    Wrong title, I wanted to have the title set as "XML reports line-rate=0 for empty files, should be 1". I created the issue while I was signed out but now I can't edit it anymore.

  2. Log in to comment