mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #26840 -- Added test.utils.setup/teardown_databases().
This commit is contained in:
parent
ff445f4c19
commit
e76981b433
6 changed files with 214 additions and 164 deletions
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue