nose2
nose2 copied to clipboard
TestCase with only generator method does not run any fixtures
... at least, not until the generator starts generating tests. This means you can't use setupClass to populate a list that several generator tests use.
Is this still relevant? Is it a bug? Can you point me to where exactly it should be fixed?
I think this is related to #80, or to the cause of #80, which is the way the generators plugin generates tests. It should work like the parameters plugin -- generate new methods on the test case instance and let the normal testcase loader plugin collect them. That should solve all of these issues that derive from generator test cases being attached to the wrong testcase instance.
I resolved this issue creating the class variables (fixtures) in the class directly instead of in the setUpClass method. eg:
class TestAvro(unittest.TestCase):
products = json.load(open('products.json'))
contents = json.load(open('contents.json'))
@classmethod
def setUpClass(cls):
pass
... test with yield