Skip to content
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

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

Closed
nedbat opened this issue Dec 18, 2014 · 2 comments
Closed

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

nedbat opened this issue Dec 18, 2014 · 2 comments
Labels
bug Something isn't working xml

Comments

@nedbat
Copy link
Owner

nedbat commented Dec 18, 2014

Originally reported by Anonymous


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

<?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 -->
	<packages>
		<package branch-rate="0" complexity="0" line-rate="1" name="">
			<classes>
				<class branch-rate="0" complexity="0" filename="dummy/__init__.py" line-rate="0" name="dummy/__init__">
					<methods/>
					<lines/>
				</class>
				<class branch-rate="0" complexity="0" filename="dummy/dummy.py" line-rate="1" name="dummy/dummy">
					<methods/>
					<lines>
						<line hits="1" number="1"/>
						<line hits="1" number="2"/>
						<line hits="1" number="4"/>
						<line hits="1" number="5"/>
					</lines>
				</class>
				<class branch-rate="0" complexity="0" filename="dummy/dummy2.py" line-rate="1" name="dummy/dummy2">
					<methods/>
					<lines>
						<line hits="1" number="1"/>
						<line hits="1" number="2"/>
					</lines>
				</class>
			</classes>
		</package>
	</packages>
</coverage>

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%

@nedbat
Copy link
Owner Author

nedbat commented Dec 18, 2014

Original comment by Alexandre Conrad (Bitbucket: aconrad, GitHub: aconrad)


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.

@nedbat
Copy link
Owner Author

nedbat commented Jan 17, 2015

Thanks, fixed in 810bdefd24ce (bb)

@nedbat nedbat closed this as completed Jan 17, 2015
@nedbat nedbat added major bug Something isn't working xml labels Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working xml
Projects
None yet
Development

No branches or pull requests

1 participant