20240805130759-django setUpClass leaks transactions
Any failure in setUpTestData or setUpClass will cause TearDownClass not to run. That’s why setUpclass and TearDownClass need to work like a super sandwich:
class MyTestCase(TestCase):
@staticmethod
def setUpClass(cls):
custom_code_does_thing()
super().setUpClass()
@staticmethod
def tearDownClass(cls):
super().tearDownClass()
custom_code_removes_thing()