mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #22487: Don't flush out data from before normal TestCases
This commit is contained in:
parent
c33447a50c
commit
0fba4c0ed7
3 changed files with 19 additions and 17 deletions
|
@ -1,11 +1,11 @@
|
|||
from django.test import TransactionTestCase
|
||||
from django.test import TransactionTestCase, TestCase
|
||||
from .models import Book
|
||||
|
||||
|
||||
class MigrationDataPersistenceTestCase(TransactionTestCase):
|
||||
"""
|
||||
Tests that data loaded in migrations is available if we set
|
||||
serialized_rollback = True.
|
||||
serialized_rollback = True on TransactionTestCase
|
||||
"""
|
||||
|
||||
available_apps = ["migration_test_data_persistence"]
|
||||
|
@ -18,16 +18,13 @@ class MigrationDataPersistenceTestCase(TransactionTestCase):
|
|||
)
|
||||
|
||||
|
||||
class MigrationDataNoPersistenceTestCase(TransactionTestCase):
|
||||
class MigrationDataNormalPersistenceTestCase(TestCase):
|
||||
"""
|
||||
Tests the failure case
|
||||
Tests that data loaded in migrations is available on TestCase
|
||||
"""
|
||||
|
||||
available_apps = ["migration_test_data_persistence"]
|
||||
serialized_rollback = False
|
||||
|
||||
def test_no_persistence(self):
|
||||
def test_persistence(self):
|
||||
self.assertEqual(
|
||||
Book.objects.count(),
|
||||
0,
|
||||
1,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue