From f5ebdfce5c417f9844e86bccc2f12577064d4bad Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Tue, 12 Nov 2019 19:49:09 -0800 Subject: Fixed #25388 -- Added an option to allow disabling of migrations during test database creation. --- docs/ref/django-admin.txt | 5 +++-- docs/ref/settings.txt | 19 ++++++++++++++++--- docs/releases/3.1.txt | 3 +++ 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 8203220159..c08fe44346 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -1371,8 +1371,9 @@ Preserves the test database between test runs. This has the advantage of skipping both the create and destroy actions which can greatly decrease the time to run tests, especially those in a large test suite. If the test database does not exist, it will be created on the first run and then preserved for each -subsequent run. Any unapplied migrations will also be applied to the test -database before running the test suite. +subsequent run. Unless the :setting:`MIGRATE ` test setting is +``False``, any unapplied migrations will also be applied to the test database +before running the test suite. .. django-admin-option:: --reverse, -r diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 97b1584765..a32cc4e2a4 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -739,6 +739,17 @@ The creation-order dependencies of the database. See the documentation on :ref:`controlling the creation order of test databases ` for details. +.. setting:: TEST_MIGRATE + +``MIGRATE`` +^^^^^^^^^^^ + +.. versionadded:: 3.1 + +Default: ``True`` + +When set to ``False``, migrations won't run when creating the test database. + .. setting:: TEST_MIRROR ``MIRROR`` @@ -2034,9 +2045,11 @@ automatically create the package if it doesn't already exist. When you supply ``None`` as a value for an app, Django will consider the app as an app without migrations regardless of an existing ``migrations`` submodule. This can be used, for example, in a test settings file to skip migrations while -testing (tables will still be created for the apps' models). If this is used in -your general project settings, remember to use the :option:`migrate ---run-syncdb` option if you want to create tables for the app. +testing (tables will still be created for the apps' models). To disable +migrations for all apps during tests, you can set the +:setting:`MIGRATE ` to ``True`` instead. If ``MIGRATION_MODULES`` +is used in your general project settings, remember to use the +:option:`migrate --run-syncdb` option if you want to create tables for the app. .. setting:: MONTH_DAY_FORMAT diff --git a/docs/releases/3.1.txt b/docs/releases/3.1.txt index 14e00bdf56..16f9ed01be 100644 --- a/docs/releases/3.1.txt +++ b/docs/releases/3.1.txt @@ -237,6 +237,9 @@ Tests allow running a test without collecting the result and catching exceptions. This can be used to support running tests under a debugger. +* The new :setting:`MIGRATE ` test database setting allows + disabling of migrations during a test database creation. + URLs ~~~~ -- cgit v1.3