nose-devs / nose2

The successor to nose, based on unittest2
https://nose2.io
Other
794 stars 135 forks source link

TestCase with only generator method does not run any fixtures #46

Open jpellerin opened 12 years ago

jpellerin commented 12 years ago

... 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.

thedrow commented 11 years ago

Is this still relevant? Is it a bug? Can you point me to where exactly it should be fixed?

jpellerin commented 11 years ago

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.

lucagiove commented 6 years ago

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