nose-devs/nose — Issue #354: collect-only plugin does not work with test generator yield
Author: jpellerin
Created: 2011-12-14 16:08:56+00:00
State: closed

What steps will reproduce the problem?

1. Define the following simple test:

def generate_even_tests():
for i in range(0, 5):
yield check_even, i, i*3

def check_even(n, nn):
assert n % 2 == 0 or nn % 2 == 0

2. run
$ nosetests --collect-only
Traceback (most recent call last):
File "/usr/bin/nosetests", line 8, in
load_entry_point('nose==0.11.0', 'console_scripts', 'nosetests')()
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/core.py", line
113, in __init__
argv=argv, testRunner=testRunner, testLoader=testLoader)
File "/usr/lib/python2.5/unittest.py", line 768, in __init__
self.runTests()
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/core.py", line
192, in runTests
result = self.testRunner.run(self.test)
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/core.py", line
61, in run
test(result)
File "/usr/lib/python2.5/unittest.py", line 437, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python2.5/unittest.py", line 433, in run
test(result)
File "/usr/lib/python2.5/unittest.py", line 437, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python2.5/unittest.py", line 430, in run
for test in self._tests:
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/suite.py",
line 83, in _get_tests
for test in self.test_generator:
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/loader.py",
line 157, in loadTestsFromDir
entry_path, discovered=True)
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/loader.py",
line 394, in loadTestsFromName
discovered=discovered)
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/loader.py",
line 305, in loadTestsFromModule
test_classes + test_funcs)
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/loader.py",
line 304, in
tests = map(lambda t: self.makeTest(t, parent=module),
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/loader.py",
line 526, in makeTest
return self.loadTestsFromGenerator(obj, parent)
File
"/usr/lib/python2.5/site-packages/nose-0.11.0-py2.5.egg/nose/loader.py",
line 235, in loadTestsFromGenerator
return self.suiteClass(generate, context=generator, can_split=False)
TypeError: __call__() got an unexpected keyword argument 'context'

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

Google Code Info:
Issue #: 302
Author: housemaister
Created On: 2009-11-04T15:44:43.000Z
Closed On: 2009-11-04T15:59:44.000Z