summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/testing/advanced.txt13
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt
index 046f663672..13041c1945 100644
--- a/docs/topics/testing/advanced.txt
+++ b/docs/topics/testing/advanced.txt
@@ -485,7 +485,7 @@ django.db.connection.creation
The creation module of the database backend also provides some utilities that
can be useful during testing.
-.. function:: create_test_db([verbosity=1, autoclobber=False])
+.. function:: create_test_db([verbosity=1, autoclobber=False, keepdb=False])
Creates a new test database and runs ``migrate`` against it.
@@ -501,13 +501,19 @@ can be useful during testing.
* If autoclobber is ``True``, the database will be destroyed
without consulting the user.
+ ``keepdb`` determines if the test run should use an existing
+ database, or create a new one. If ``True``, the existing
+ database will be used, or created if not present. If ``False``,
+ a new database will be created, prompting the user to remove
+ the existing one, if present.
+
Returns the name of the test database that it created.
``create_test_db()`` has the side effect of modifying the value of
:setting:`NAME` in :setting:`DATABASES` to match the name of the test
database.
-.. function:: destroy_test_db(old_database_name, [verbosity=1])
+.. function:: destroy_test_db(old_database_name, [verbosity=1, keepdb=False])
Destroys the database whose name is the value of :setting:`NAME` in
:setting:`DATABASES`, and sets :setting:`NAME` to the value of
@@ -516,6 +522,9 @@ can be useful during testing.
The ``verbosity`` argument has the same behavior as for
:class:`~django.test.runner.DiscoverRunner`.
+ If the ``keepdb`` argument is ``True``, then the connection to the
+ database will be closed, but the database will not be destroyed.
+
.. _topics-testing-code-coverage:
Integration with coverage.py