diff options
| author | Greg Chapple <gregchapple1@gmail.com> | 2014-05-27 22:13:08 +0100 |
|---|---|---|
| committer | Greg Chapple <gregchapple1@gmail.com> | 2014-05-28 16:22:46 +0100 |
| commit | b7aa7c4ab4372d2b7994d252c8bc87f77dd217ae (patch) | |
| tree | 2466569c39afe585f6870dcf26bb9ec42f052c2b /docs | |
| parent | 2e613ea5c52d4d12e071987178af18c0371d6e2f (diff) | |
Fixed #20550 -- Added ability to preserve test db between runs
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/django-admin.txt | 11 | ||||
| -rw-r--r-- | docs/releases/1.8.txt | 3 | ||||
| -rw-r--r-- | docs/topics/testing/overview.txt | 8 |
3 files changed, 22 insertions, 0 deletions
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 6bb67f01fc..9291479305 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -1310,6 +1310,17 @@ The ``--liveserver`` option can be used to override the default address where the live server (used with :class:`~django.test.LiveServerTestCase`) is expected to run from. The default value is ``localhost:8081``. +.. django-admin-option:: --keepdb + +.. versionadded:: 1.8 + +The ``--keepdb`` option can be used to preserve the test database between test +runs. This has the advantage of skipping both the create and destroy actions +which greatly decreases 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. + testserver <fixture fixture ...> -------------------------------- diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index b0e3b035c0..3c5a44fc44 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -189,6 +189,9 @@ Tests * The new :meth:`~django.test.SimpleTestCase.assertJSONNotEqual` assertion allows you to test that two JSON fragments are not equal. +* Added the ability to preserve the test database by adding the :djadminopt:`--keepdb` + flag. + Validators ^^^^^^^^^^ diff --git a/docs/topics/testing/overview.txt b/docs/topics/testing/overview.txt index 10dbc70f39..2d9808f0bc 100644 --- a/docs/topics/testing/overview.txt +++ b/docs/topics/testing/overview.txt @@ -149,6 +149,14 @@ Tests that require a database (namely, model tests) will not use your "real" Regardless of whether the tests pass or fail, the test databases are destroyed when all the tests have been executed. +.. versionadded:: 1.8 + + You can prevent the test databases from being destroyed by adding the + :djadminopt:`--keepdb` flag to the test command. This will preserve the test + database between runs. If the database does not exist, it will first + be created. Any migrations will also be applied in order to keep it + up to date. + By default the test databases get their names by prepending ``test_`` to the value of the :setting:`NAME` settings for the databases defined in :setting:`DATABASES`. When using the SQLite database engine |
