mirror of
https://github.com/Hopiu/django.git
synced 2026-04-21 15:24:50 +00:00
Data loaded in migrations were restored at the beginning of each TransactionTestCase and all the tables are truncated at the end of these test cases. If there was a TransactionTestCase at the end of the test suite, the migrated data weren't restored in the database (especially unexpected when using --keepdb). Now data is restored at the end of each TransactionTestCase.
37 lines
883 B
Python
37 lines
883 B
Python
from unittest import TestCase
|
|
|
|
from django.test import TestCase as DjangoTestCase, TransactionTestCase
|
|
|
|
|
|
class TestVanillaUnittest(TestCase):
|
|
def test_sample(self):
|
|
self.assertEqual(1, 1)
|
|
|
|
|
|
class TestDjangoTestCase(DjangoTestCase):
|
|
def test_sample(self):
|
|
self.assertEqual(1, 1)
|
|
|
|
|
|
class TestTransactionTestCase1(TransactionTestCase):
|
|
available_apps = ['test_discovery_sample3']
|
|
serialized_rollback = False
|
|
|
|
def test_sample(self):
|
|
self.assertEqual(1, 1)
|
|
|
|
|
|
class TestTransactionTestCase2(TransactionTestCase):
|
|
available_apps = ['test_discovery_sample3']
|
|
serialized_rollback = True
|
|
|
|
def test_sample(self):
|
|
self.assertEqual(1, 1)
|
|
|
|
|
|
class TestTransactionTestCase3(TransactionTestCase):
|
|
available_apps = ['test_discovery_sample3']
|
|
serialized_rollback = False
|
|
|
|
def test_sample(self):
|
|
self.assertEqual(1, 1)
|