nose-devs/nose — Issue #216: --with-coverage crashes when reporting on some stdlib modules
Author: jpellerin
Created: 2011-12-14 16:04:01+00:00
State: open

What steps will reproduce the problem?
1. mkdir spam && cp spam.py test_spam.py spam
2. nosetests --with-coverage spam

(where spam.py and test_spam.py are the attached files)

What is the expected output? What do you see instead?

Expected: nose-reported errors, logged by .addError.
Got: traceback (no doubt other failures are possible):

.
Traceback (most recent call last):
File "/usr/bin/nosetests", line 8, in
load_entry_point('nose==0.10.0b1', 'console_scripts', 'nosetests')()
File "/home/john/src/nose/nose/core.py", line 188, in __init__
argv=argv, testRunner=testRunner, testLoader=testLoader)
File "/usr/lib/python2.5/unittest.py", line 768, in __init__
self.runTests()
File "/home/john/src/nose/nose/core.py", line 263, in runTests
result = self.testRunner.run(self.test)
File "/home/john/src/nose/nose/core.py", line 64, in run
result.printErrors()
File "/home/john/src/nose/nose/result.py", line 72, in printErrors
self.config.plugins.report(self.stream)
File "/home/john/src/nose/nose/plugins/manager.py", line 79, in __call__
return self.call(*arg, **kw)
File "/home/john/src/nose/nose/plugins/manager.py", line 135, in simple
result = meth(*arg, **kw)
File "/home/john/src/nose/nose/plugins/cover.py", line 99, in report
coverage.report(modules, file=stream)
File "/home/john/lib/python/coverage.py", line 957, in report
File "/home/john/lib/python/coverage.py", line 812, in report
File "/home/john/lib/python/coverage.py", line 797, in morf_name_compare
File "/home/john/lib/python/coverage.py", line 780, in morf_name
File "/usr/lib/python2.5/posixpath.py", line 92, in splitext
i = p.rfind('.')
File "email/__init__.py", line 82, in __getattr__
AttributeError: 'module' object has no attribute 'rfind'

What version of the product are you using? On what operating system?

http://python-nose.googlecode.com/svn/branches/0.10.0-stable revision 315,
Ubuntu Linux.

Please provide any additional information below.

Workaround for specific cases such as this stdlib case is to use
--cover-package option. But presumably similar cases could cause nose to
crash when reporting on modules for which coverage data is in fact wanted.

Google Code Info:
Issue #: 90
Author: j...@pobox.com
Created On: 2007-09-10T21:00:01.000Z
Closed On: 2007-09-11T19:09:40.000Z