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 report: filenames may be generated incorrectly #67

Closed
nedbat opened this issue May 20, 2010 · 2 comments
Closed

XML report: filenames may be generated incorrectly #67

nedbat opened this issue May 20, 2010 · 2 comments
Labels
bug Something isn't working xml

Comments

@nedbat
Copy link
Owner

nedbat commented May 20, 2010

Originally reported by Chris Adams (Bitbucket: acdha, GitHub: acdha)


I ran into an odd problem using the coverage XML report on our Hudson CI server. It turns out that the xml report will generate inconsistent filenames based on the configuration.

If you call xml_report with a list of module names (e.g. "proj.submod") like this:

#!python

    cov.xml_report(
        coverage_modules
        outfile=os.path.join(options.output_dir, "coverage.xml"),
    )

the XML will be generated with module names in the filename attribute:

<class branch-rate="0.3125" complexity="0.0" filename="bin.test-coverage" line-rate="0.415841584158" name="test-coverage">

If you instead filter the report using something like include/omit_prefixes:

#!python

    cov.xml_report(
        outfile=os.path.join(options.output_dir, "coverage.xml"),
        include_prefixes=[PROJECT_ROOT], 
        omit_prefixes=[os.path.join(PROJECT_ROOT, "proto", "templates")]
    )

the XML will have real filesystem paths in the filename attribute:

<class branch-rate="0.3125" complexity="0.0" filename="bin/test-coverage.py" line-rate="0.415841584158" name="test-coverage">

@nedbat
Copy link
Owner Author

nedbat commented Oct 25, 2012

Original comment by karlp (Bitbucket: karlp, GitHub: karlp)


This is also the sort of difference when using coverage from within nose vs running coverage xml after nose has generated the .coverage file.

@nedbat
Copy link
Owner Author

nedbat commented Nov 22, 2012

Fixed in <<changeset 6af3ba6d (bb)>>.

@nedbat nedbat closed this as completed Nov 22, 2012
@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