These are chat archives for django/django

Oct 2017
Oct 25 2017 07:22

I have these TestCases:

class ComponentTest(TestCase):
    fixtures = ['data.json']

    def setUpTestData(cls):
        # ...

class Component1Test(ComponentTest):
    # ...

class Component2Test(ComponentTest):
    # ...

When running test, fixture load and setUpTestData is run multiple times, both for Component1Test and Component2Test separately. Is there any way I could make it run just once?

Oct 25 2017 10:49 kpagcha (Gitter): the unittest model is designed to build a test suite of independent test cases. That is, the set up tends to be done each time a test case starts. kpagcha (Gitter): If you want a bunch of setup that persists between test cases, they're not really independent and you won't be testing whether things work correctly in isolation. kpagcha (Gitter): Maybe you don't want unit tests?