pombreda / python-nose

Automatically exported from code.google.com/p/python-nose
0 stars 0 forks source link

Missing (but irrelivant) source-code causes a failure to generate HTML coverage reprort, non-zero exit code #347

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to do a coverage analysis on a large project, some of the components 
(whose content I'm not particularly interested in) are installed as zipped eggs 
and not all eggs include source code.  

In this case, the coverage analysis fails. Nose exits with a non-zero exit code 
No HTML output was produced. The Xunit output file was zero bytes long.

IMO, this feature is not failing safely. On a very big project it's quite 
possible that not all of the source code will be available, especially if the 
developers make use of eggs. It would be better if the coverage report could 
degrade gracefully and not throw a fatal error in the case where it may 
actually pe possible to produce a report, however basic.

=== FINAL OUTPUT BELOW ===

TOTAL                                                                           
                           384    248    64%   
Traceback (most recent call last):
  File "d:\hudson\workspace\test_unittest_coverage1\scripts_12\calyon_nosetests-script.py", line 7, in ?
    sys.exit(
  File "build\bdist.win32\egg\calyon\command_line\calyon_nosetests.py", line 9, in main
  File "d:\python24\lib\site-packages\nose-0.11.1-py2.4.egg\nose\core.py", line 271, in run
    return TestProgram(*arg, **kw).success
  File "d:\python24\lib\site-packages\nose-0.11.1-py2.4.egg\nose\core.py", line 113, in __init__
    argv=argv, testRunner=testRunner, testLoader=testLoader)
  File "D:\Python24\lib\unittest.py", line 759, in __init__
    self.runTests()
  File "d:\python24\lib\site-packages\nose-0.11.1-py2.4.egg\nose\core.py", line 192, in runTests
    result = self.testRunner.run(self.test)
  File "d:\python24\lib\site-packages\nose-0.11.1-py2.4.egg\nose\core.py", line 63, in run
    result.printErrors()
  File "d:\python24\lib\site-packages\nose-0.11.1-py2.4.egg\nose\result.py", line 88, in printErrors
    self.config.plugins.report(self.stream)
  File "d:\python24\lib\site-packages\nose-0.11.1-py2.4.egg\nose\plugins\manager.py", line 82, in __call__
    return self.call(*arg, **kw)
  File "d:\python24\lib\site-packages\nose-0.11.1-py2.4.egg\nose\plugins\manager.py", line 150, in simple
    result = meth(*arg, **kw)
  File "d:\python24\lib\site-packages\nose-0.11.1-py2.4.egg\nose\plugins\cover.py", line 168, in report
    coverage.annotate(files.values())
  File "d:\python24\lib\site-packages\coverage-3.3.1-py2.4-win32.egg\coverage\__init__.py", line 39, in wrapper
    return getattr(_the_coverage, name)(*args, **kwargs)
  File "d:\python24\lib\site-packages\coverage-3.3.1-py2.4-win32.egg\coverage\control.py", line 345, in annotate
    reporter.report(
  File "d:\python24\lib\site-packages\coverage-3.3.1-py2.4-win32.egg\coverage\annotate.py", line 38, in report
    self.report_files(self.annotate_file, morfs, directory, omit_prefixes)
  File "d:\python24\lib\site-packages\coverage-3.3.1-py2.4-win32.egg\coverage\report.py", line 57, in report_files
    report_fn(cu, self.coverage._analyze(cu))
  File "d:\python24\lib\site-packages\coverage-3.3.1-py2.4-win32.egg\coverage\control.py", line 309, in _analyze
    return Analysis(self, it)
  File "d:\python24\lib\site-packages\coverage-3.3.1-py2.4-win32.egg\coverage\results.py", line 24, in __init__
    raise NoSource("No source for code: %r" % self.filename)
coverage.misc.NoSource: No source for code: 
'd:\\hudson\\workspace\\test_unittest_coverage1\\integration\\calyon_unittest\\u
tils\\threemm.py'

Original issue reported on code.google.com by salimfadhley@gmail.com on 25 Jun 2010 at 7:16

GoogleCodeExporter commented 9 years ago
I've not used "annotate", but when using "html_report" I found "ignore_errors" 
kwarg  useful to ignore this exception... YMMV.

cov.html_report(directory='covhtml', ignore_errors=1)

Original comment by hockley....@gmail.com on 20 Sep 2010 at 3:08