Sorin Sbârnea
unread,Sep 15, 2010, 7:31:54 AM9/15/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Coverage.py Development
If I try to run os.system("coverage xml") after running nose in a
python script I do get:
"No data to report." This is happening even when I run coverage using
its API.
If I disable the call of nose I do get the desired results.
At first i assumed that this may be caused by a current directory
change made by nose so I added:
os.chdir(os.path.dirname(os.path.abspath(__file__))) - because I have
the .coverage file in the same directory as the py script (running
`coverage xml` from the command line works!)
But this did not solve the problem.
It looks that if by default "coverage xml" will fail to run if you
have command line parameters. In addition to this even if you try to
restore the sys.argv does not solve the problem.
cov.xml_report(ignore_errors=True, outfile='coverage.xml')
File "/Library/Python/2.6/site-packages/coverage-3.4b2-py2.6-
macosx-10.6-universal.egg/coverage/control.py", line 568, in
xml_report
reporter.report(morfs, outfile=outfile, config=self.config)
File "/Library/Python/2.6/site-packages/coverage-3.4b2-py2.6-
macosx-10.6-universal.egg/coverage/xmlreport.py", line 57, in report
self.report_files(self.xml_file, morfs, config)
File "/Library/Python/2.6/site-packages/coverage-3.4b2-py2.6-
macosx-10.6-universal.egg/coverage/report.py", line 72, in
report_files
raise CoverageException("No data to report.")
coverage.misc.CoverageException: No data to report.
The problem is more important because in order to provide some
arguments to nosetests you have to alter the sys.argv before running
nose ("-w" option is available only from the command line)
Thanks,