data loaded in migrations is available if transactiontestcase serializedrollback true data loaded in migrations is available on testcase data loaded in migrations is available if transactiontestcase serialized_rollback true data loaded in migrations is available on testcase
from django.test import TestCase, TransactionTestCase

from .models import Book


class MigrationDataPersistenceTestCase(TransactionTestCase):
    

    available_apps = ["migration_test_data_persistence"]
    serialized_rollback = True

    def test_persistence(self):
        self.assertEqual(
            Book.objects.count(),
            1,
        )


class MigrationDataNormalPersistenceTestCase(TestCase):
    

    def test_persistence(self):
        self.assertEqual(
            Book.objects.count(),
            1,
        )