Apparently, moving from
django.test.TransactionTestCase solved the issue. Here are some important points regarding the differences between
TestCaseare identical except for the manner in which the database is reset to a known state and the ability for test code to test the effects of commit and rollback:
TransactionTestCaseresets the database after the test runs by truncating all tables. A
TransactionTestCasemay call commit and rollback and observe the effects of these calls on the database.
TestCase, on the other hand, does not truncate tables after a test. Instead, it encloses the test code in a database transaction that is rolled back at the end of the test. This guarantees that the rollback at the end of the test restores the database to its initial state.
Here you can find more details from the docs TransactionTestCase