diff options
| author | Andreas Pelme <andreas@pelme.se> | 2016-07-03 00:20:14 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-17 13:55:04 -0400 |
| commit | e76981b43325da60b8a7475661df6cbfa7fda37e (patch) | |
| tree | e8d521a2063177186b11ff330698905a2ba4e69e /docs | |
| parent | ff445f4c19a0fdf6696c99efefa38b1409b8709f (diff) | |
Fixed #26840 -- Added test.utils.setup/teardown_databases().
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/internals/deprecation.txt | 2 | ||||
| -rw-r--r-- | docs/releases/1.11.txt | 7 | ||||
| -rw-r--r-- | docs/topics/testing/advanced.txt | 34 |
3 files changed, 33 insertions, 10 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 400fcf8789..e5151ebadc 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -23,6 +23,8 @@ details on these changes. * The ``extra_context`` parameter of ``contrib.auth.views.logout_then_login()`` will be removed. +* ``django.test.runner.setup_databases()`` will be removed. + .. _deprecation-removed-in-2.0: 2.0 diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt index 57cda8ae8b..a09e38a3ae 100644 --- a/docs/releases/1.11.txt +++ b/docs/releases/1.11.txt @@ -275,6 +275,10 @@ Tests * Added the :option:`test --debug-mode` option to help troubleshoot test failures by setting the :setting:`DEBUG` setting to ``True``. +* The new :func:`django.test.utils.setup_databases` (moved from + ``django.test.runner``) and :func:`~django.test.utils.teardown_databases` + functions make it easier to build custom test runners. + URLs ~~~~ @@ -425,3 +429,6 @@ Miscellaneous :class:`~django.contrib.auth.views.PasswordResetDoneView`, :class:`~django.contrib.auth.views.PasswordResetConfirmView`, and :class:`~django.contrib.auth.views.PasswordResetCompleteView`. + +* ``django.test.runner.setup_databases()`` is moved to + :func:`django.test.utils.setup_databases`. The old location is deprecated. diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt index 72a8c7276c..3cd60bc03c 100644 --- a/docs/topics/testing/advanced.txt +++ b/docs/topics/testing/advanced.txt @@ -563,11 +563,8 @@ Methods .. method:: DiscoverRunner.setup_databases(**kwargs) - Creates the test databases. - - Returns a data structure that provides enough detail to undo the changes - that have been made. This data will be provided to the ``teardown_databases()`` - function at the conclusion of testing. + Creates the test databases by calling + :func:`~django.test.utils.setup_databases`. .. method:: DiscoverRunner.run_suite(suite, **kwargs) @@ -584,11 +581,8 @@ Methods .. method:: DiscoverRunner.teardown_databases(old_config, **kwargs) - Destroys the test databases, restoring pre-test conditions. - - ``old_config`` is a data structure defining the changes in the - database configuration that need to be reversed. It is the return - value of the ``setup_databases()`` method. + Destroys the test databases, restoring pre-test conditions by calling + :func:`~django.test.utils.teardown_databases`. .. method:: DiscoverRunner.teardown_test_environment(**kwargs) @@ -629,6 +623,26 @@ 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, keepdb=False, debug_sql=False, parallel=0, **kwargs) + + .. versionadded:: 1.11 + + Creates the test databases. + + Returns a data structure that provides enough detail to undo the changes + that have been made. This data will be provided to the + :func:`teardown_databases` function at the conclusion of testing. + +.. function:: teardown_databases(old_config, parallel=0, keepdb=False) + + .. versionadded:: 1.11 + + Destroys the test databases, restoring pre-test conditions. + + ``old_config`` is a data structure defining the changes in the database + configuration that need to be reversed. It's the return value of the + :meth:`setup_databases` method. + ``django.db.connection.creation`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
