erikrose/nose-progressive — Issue #23: nose-progressive causes issue with generator methods/setup_class
Author: dwf
Created: 2011-11-08 19:09:52+00:00
State: open

See the following example:

```python
class TestDemo(object):
@classmethod
def setup_class(cls):
cls.list_of_things = range(2)

@classmethod
def teardown_class(cls):
del cls.list_of_things

def checker(self, index):
assert True

def test_driver(self):
for index in range(len(self.list_of_things)):
yield self.checker, index
```

Output of just `nosetests`:

```

wardefar@atchoum:~$ nosetests test.py
..
----------------------------------------------------------------------
Ran 2 tests in 0.001s

OK
wardefar@atchoum:~$ nosetests test.py
..
----------------------------------------------------------------------
Ran 2 tests in 0.001s

OK
wardefar@atchoum:~$ nosetests --with-progressive test.py
Traceback (most recent call last):
File "/usr/bin/nosetests", line 8, in
load_entry_point('nose==0.10.3', 'console_scripts', 'nosetests')()
File "/usr/lib/python2.5/site-packages/nose/core.py", line 219, in __init__
argv=argv, testRunner=testRunner, testLoader=testLoader)
File "/usr/lib64/python2.5/unittest.py", line 767, in __init__
self.parseArgs(argv)
File "/usr/lib/python2.5/site-packages/nose/core.py", line 270, in parseArgs
self.createTests()
File "/usr/lib/python2.5/site-packages/nose/core.py", line 284, in createTests
self.test = self.testLoader.loadTestsFromNames(self.testNames)
File "/u/wardefar/src/nose-progressive/noseprogressive/plugin.py", line 120, in capture_suite
self._totalTests += orig_method(*args, **kwargs).countTestCases()
File "/usr/lib64/python2.5/unittest.py", line 410, in countTestCases
cases += test.countTestCases()
File "/usr/lib64/python2.5/unittest.py", line 410, in countTestCases
cases += test.countTestCases()
File "/usr/lib64/python2.5/unittest.py", line 410, in countTestCases
cases += test.countTestCases()
File "/usr/lib64/python2.5/unittest.py", line 409, in countTestCases
for test in self._tests:
File "/usr/lib/python2.5/site-packages/nose/suite.py", line 277, in _get_wrapped_tests
for test in self._get_tests():
File "/usr/lib/python2.5/site-packages/nose/suite.py", line 76, in _get_tests
for test in self.test_generator:
File "/usr/lib/python2.5/site-packages/nose/loader.py", line 249, in generate
for test in g():
File "/u/wardefar/test.py", line 14, in test_driver
for index in range(len(self.list_of_things)):
AttributeError: 'TestDemo' object has no attribute 'list_of_things'
```