diff options
| author | Tim Graham <timograham@gmail.com> | 2013-05-06 13:55:02 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-05-06 13:56:48 -0400 |
| commit | acd9dc3888aa8af881b917028062c3bdca6e610c (patch) | |
| tree | 43cb34db991e8669af7ed07234a104aa49732f6e /docs | |
| parent | 1ef423b003c9ead08a00fdba54507e95539a5734 (diff) | |
[1.5.x] Fixed #20177 - Corrected docs for django.test.utils.setup_test_environment.
Thanks vlad.london.uk@ for the report.
Backport of bc02a963db from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/intro/tutorial05.txt | 7 | ||||
| -rw-r--r-- | docs/topics/testing/advanced.txt | 12 |
2 files changed, 15 insertions, 4 deletions
diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt index 999326eae9..5229856f08 100644 --- a/docs/intro/tutorial05.txt +++ b/docs/intro/tutorial05.txt @@ -327,6 +327,13 @@ in the shell:: >>> from django.test.utils import setup_test_environment >>> setup_test_environment() +:meth:`~django.test.utils.setup_test_environment` installs a template renderer +which will allow us to examine some additional attributes on responses such as +``response.context`` that otherwise wouldn't be available. Note that this +method *does not* setup a test database, so the following will be run against +the existing database and the output may differ slightly depending on what +polls you already created. + Next we need to import the test client class (later in ``tests.py`` we will use the :class:`django.test.TestCase` class, which comes with its own client, so this won't be required):: diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt index 0de07cd988..50cf25b4b4 100644 --- a/docs/topics/testing/advanced.txt +++ b/docs/topics/testing/advanced.txt @@ -163,10 +163,12 @@ environment first. Django provides a convenience method to do this:: >>> from django.test.utils import setup_test_environment >>> setup_test_environment() -This convenience method sets up the test database, and puts other -Django features into modes that allow for repeatable testing. +:func:`~django.test.utils.setup_test_environment` puts several Django features +into modes that allow for repeatable testing, but does not create the test +databases; :func:`django.test.simple.DjangoTestSuiteRunner.setup_databases` +takes care of that. -The call to :meth:`~django.test.utils.setup_test_environment` is made +The call to :func:`~django.test.utils.setup_test_environment` is made automatically as part of the setup of ``./manage.py test``. You only need to manually invoke this method if you're not using running your tests via Django's test runner. @@ -286,7 +288,9 @@ Methods .. method:: DjangoTestSuiteRunner.setup_test_environment(**kwargs) - Sets up the test environment ready for testing. + Sets up the test environment by calling + :func:`~django.test.utils.setup_test_environment` and setting + :setting:`DEBUG` to ``False``. .. method:: DjangoTestSuiteRunner.build_suite(test_labels, extra_tests=None, **kwargs) |
