'django setUpTestData doesn't run

Here is my test:

class FirstTestCase(TransactionTestCase):
    @classmethod
    def setUpTestData(cls):
        Car.objects.create(id=10001)

    def findAllCars(self):
        print(list(Car.objects.all()))

this gives no errors, and the list is simply printed as [], when clearly it should be [10001]

I know tests aren't supposed to inlude print statements, this is just an easy way to illustrate that for some reason the object in setUpTestData is not being created. How can I get it to make this object?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source