diff options
| author | romgar <romain.garrigues.cs@gmail.com> | 2016-11-07 22:08:40 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-11-06 16:57:50 -0500 |
| commit | b3b1d3d45fc066367f4fcacf0b06f72fcd00a9c6 (patch) | |
| tree | d6e9a8846da45a0afe642a2957f2ed7dbf286336 /docs | |
| parent | ecac6d7a2a510cb0a5d772deeca633c99c9687e5 (diff) | |
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.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/settings.txt | 5 | ||||
| -rw-r--r-- | docs/releases/2.2.txt | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index dd65e451c2..a3f6f421dd 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -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`` diff --git a/docs/releases/2.2.txt b/docs/releases/2.2.txt index 3c8e866a39..49fa9b0ba4 100644 --- a/docs/releases/2.2.txt +++ b/docs/releases/2.2.txt @@ -298,6 +298,17 @@ Database backend API * Support for GDAL 1.9 and 1.10 is dropped. +``TransactionTestCase`` serialized data loading +----------------------------------------------- + +Initial data migrations are now loaded in +:class:`~django.test.TransactionTestCase` at the end of the test, after the +database flush. In older versions, this data was loaded at the beginning of the +test, but this prevents the :option:`test --keepdb` option from working +properly (the database was empty at the end of the whole test suite). This +change shouldn't have an impact on your tests unless you've customized +:class:`~django.test.TransactionTestCase`'s internals. + Miscellaneous ------------- |
