nose-devs/nose — Issue #298: doctest fails when there are no objects produced by a test path
Author: jpellerin
Created: 2011-12-14 16:06:54+00:00
State: closed

What steps will reproduce the problem?
1. create an empty test file, name it test_foos.py (it should have no code
in it whatsoever)
2. run `nosetests test_foos.py:Bogus --with-doctest`

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

Since Bogus doesn't exist, nothing should happen. Instead, nose raises
this traceback:

kumar-leapfrogonline-com:~/tmp/test_foos kumar$ nosetests
test_foos.py:Bogus --with-doctest
Failure: exceptions.ValueError(DocTestFinder.find: name must be given when
obj.__name__ doesn't exist: ) ... ERROR

======================================================================
ERROR: Failure: exceptions.ValueError(DocTestFinder.find: name must be
given when obj.__name__ doesn't exist: )
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/nose-0.10.0-py2.4.egg/nose/loader.py",
line 486, in makeTest
for test in self.config.plugins.makeTest(obj, parent):
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/nose-0.10.0-py2.4.egg/nose/plugins/manager.py",
line 81, in __call__
return self.call(*arg, **kw)
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/nose-0.10.0-py2.4.egg/nose/plugins/manager.py",
line 101, in
return lambda *arg, **kw: list(self.generate(*arg, **kw))
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/nose-0.10.0-py2.4.egg/nose/plugins/manager.py",
line 138, in generate
for r in result:
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/nose-0.10.0-py2.4.egg/nose/plugins/doctests.py",
line 145, in makeTest
doctests = self.finder.find(obj, module=getmodule(parent))
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.7a1dev_r56320-py2.4.egg/doctest.py",
line 824, in find
raise ValueError("DocTestFinder.find: name must be given "
ValueError: DocTestFinder.find: name must be given when obj.__name__
doesn't exist:

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

Google Code Info:
Issue #: 136
Author: kumar.mcmillan
Created On: 2007-11-27T17:07:33.000Z
Closed On: 2007-12-21T00:04:07.000Z