From 3089018e951dcca568574c0e0ebf9d8aab112389 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sun, 14 Feb 2021 22:42:47 -0500 Subject: Fixed #32446 -- Deprecated SERIALIZE test database setting. Whether or not the state of a test database should be serialized can be inferred from the set of databases allowed to be access from discovered TestCase/TransactionTestCase enabling the serialized_rollback feature which makes this setting unnecessary. This should make a significant test suite bootstraping time difference on large projects that didn't explicitly disable test database serialization. --- docs/internals/deprecation.txt | 2 ++ docs/ref/settings.txt | 6 ++++++ docs/releases/4.0.txt | 10 ++++++++-- docs/topics/testing/advanced.txt | 11 ++++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 4db5d685d7..861242dcfd 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -15,6 +15,8 @@ about each item can often be found in the release notes of two versions prior. See the :ref:`Django 4.0 release notes ` for more details on these changes. +* The ``SERIALIZE`` test setting will be removed. + .. _deprecation-removed-in-4.1: 4.1 diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 3f18af978d..18eb941ce8 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -821,6 +821,12 @@ 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 `. +.. deprecated:: 4.0 + + This setting is deprecated as it can be inferred from the + :attr:`~django.test.TestCase.databases` with the + :ref:`serialized_rollback ` option enabled. + .. setting:: TEST_TEMPLATE ``TEMPLATE`` diff --git a/docs/releases/4.0.txt b/docs/releases/4.0.txt index 502aabd4d1..50afdb56f2 100644 --- a/docs/releases/4.0.txt +++ b/docs/releases/4.0.txt @@ -248,7 +248,11 @@ Templates Tests ~~~~~ -* ... +* The new ``serialized_aliases`` argument of + :func:`django.test.utils.setup_databases` determines which + :setting:`DATABASES` aliases test databases should have their state + serialized to allow usage of the + :ref:`serialized_rollback ` feature. URLs ~~~~ @@ -313,7 +317,9 @@ Features deprecated in 4.0 Miscellaneous ------------- -* ... +* ``SERIALIZE`` test setting is deprecated as it can be inferred from the + :attr:`~django.test.TestCase.databases` with the + :ref:`serialized_rollback ` option enabled. Features removed in 4.0 ======================= diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt index b20812c745..97072eea83 100644 --- a/docs/topics/testing/advanced.txt +++ b/docs/topics/testing/advanced.txt @@ -718,7 +718,7 @@ utility methods in the ``django.test.utils`` module. Performs global post-test teardown, such as removing instrumentation from the template system and restoring normal email services. -.. function:: setup_databases(verbosity, interactive, *, time_keeper=None, keepdb=False, debug_sql=False, parallel=0, aliases=None, **kwargs) +.. function:: setup_databases(verbosity, interactive, *, time_keeper=None, keepdb=False, debug_sql=False, parallel=0, aliases=None, serialized_aliases=None, **kwargs) Creates the test databases. @@ -730,11 +730,20 @@ utility methods in the ``django.test.utils`` module. databases should be setup for. If it's not provided, it defaults to all of :setting:`DATABASES` aliases. + The ``serialized_aliases`` argument determines what subset of ``aliases`` + test databases should have their state serialized to allow usage of the + :ref:`serialized_rollback ` feature. If + it's not provided, it defaults to ``aliases``. + .. versionchanged:: 3.2 The ``time_keeper`` kwarg was added, and all kwargs were made keyword-only. + .. versionchanged:: 4.0 + + The ``serialized_aliases`` kwarg was added. + .. function:: teardown_databases(old_config, parallel=0, keepdb=False) Destroys the test databases, restoring pre-test conditions. -- cgit v1.3