14

I'm trying to output the coverage XML of my nosetests so they show up on Hudson. The line I'm executing is:

nosetests --with-gae -v --all-modules --with-xunit --with-coverage

I see the coverage output in the console, but there's no xml file containing the coverage data. How can I get it to output the coverage xml?

2 Answers 2

25

Once you've run the nosetests command, there will be a .coverage data file in the directory. If you then run coverage xml, it will create a Cobertura-compatible XML file from the .coverage file.

Sign up to request clarification or add additional context in comments.

2 Comments

With which package do you do that? I have installed coverage with pip and it complains about xml module not existing
@hithwen when python-coverage is installed you can execute it as python -m coverage xml --include="mypackage*"
8

There is a plugin written for nosetests to do just this.

You just have to add --with-xcoverage once this package is installed. It can be found at:

https://github.com/cmheisel/nose-xcover

2 Comments

Thanks. Does this work better than the other answer? The other way tends to run coverage metrics through all the code on my PYTHONPATH, even if I tell it to just do everything in my 'tests' folder.
The option I gave is really the same but is done directly through a nose plugin. Add '--cover-package=PACKAGE_NAME' option to limit what code is included in the coverage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.