Edited docs of test.utils.setup/teardown_test_environment().

This commit is contained in:
Chris Jerdonek 2016-08-04 11:29:59 -07:00 committed by Tim Graham
parent cdf54db6c5
commit 42f9d65107
2 changed files with 10 additions and 15 deletions

View File

@ -95,11 +95,9 @@ def instrumented_test_render(self, context):
def setup_test_environment(): def setup_test_environment():
"""Perform any global pre-test setup. This involves: """
Perform global pre-test setup, such as installing the instrumented template
- Installing the instrumented test renderer renderer and setting the email backend to the locmem email backend.
- Set the email backend to the locmem email backend.
- Setting the active locale to match the LANGUAGE_CODE setting.
""" """
Template._original_render = Template._render Template._original_render = Template._render
Template._render = instrumented_test_render Template._render = instrumented_test_render
@ -120,10 +118,9 @@ def setup_test_environment():
def teardown_test_environment(): def teardown_test_environment():
"""Perform any global post-test teardown. This involves: """
Perform any global post-test teardown, such as restoring the original
- Restoring the original test renderer template renderer and restoring the email sending functions.
- Restoring the email sending functions
""" """
Template._render = Template._original_render Template._render = Template._original_render
del Template._original_render del Template._original_render

View File

@ -607,15 +607,13 @@ utility methods in the ``django.test.utils`` module.
.. function:: setup_test_environment() .. function:: setup_test_environment()
Performs any global pre-test setup, such as the installing the Performs global pre-test setup, such as installing instrumentation for the
instrumentation of the template rendering system and setting up template rendering system and setting up the dummy email outbox.
the dummy email outbox.
.. function:: teardown_test_environment() .. function:: teardown_test_environment()
Performs any global post-test teardown, such as removing the black Performs global post-test teardown, such as removing instrumentation from
magic hooks into the template system and restoring normal email the template system and restoring normal email services.
services.
``django.db.connection.creation`` ``django.db.connection.creation``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~