mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #25251 -- Made data migrations available in TransactionTestCase when using --keepdb.
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.
This commit is contained in:
@@ -777,6 +777,11 @@ the database state between tests if you don't have transactions). You can set
|
||||
this to ``False`` to speed up creation time if you don't have any test classes
|
||||
with :ref:`serialized_rollback=True <test-case-serialized-rollback>`.
|
||||
|
||||
Don't set this to ``False`` if you want to use :option:`test --keepdb`
|
||||
and your test suite contains :class:`~django.test.TransactionTestCase` or
|
||||
doesn't support transactions, as this in-memory JSON string is used to restore
|
||||
the initial data migrations in these situations.
|
||||
|
||||
.. setting:: TEST_TEMPLATE
|
||||
|
||||
``TEMPLATE``
|
||||
|
||||
Reference in New Issue
Block a user