[Django]-Fixture inheritance in django TestCase

4👍

When you override fixtures in a subclass, it replaces the fixtures, it doesn’t extend them.

You can either explicitly repeat the fixtures:

class SpecificTest(BaseTest):
    fixtures = ('users.json', 'transactions.json',)

or refer to BaseTest.fixtures in your subclass:

class SpecificTest(BaseTest):
    fixtures = BaseTest.fixtures + ('transactions.json',)

Leave a comment