Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.5.x] Fixed #20177 - Corrected docs for django.test.utils.setup_tes…

…t_environment.

Thanks vlad.london.uk@ for the report.

Backport of bc02a96 from master
  • Loading branch information...
commit acd9dc3888aa8af881b917028062c3bdca6e610c 1 parent 1ef423b
Tim Graham authored
7  docs/intro/tutorial05.txt
@@ -327,6 +327,13 @@ in the shell::
327 327
     >>> from django.test.utils import setup_test_environment
328 328
     >>> setup_test_environment()
329 329
 
  330
+:meth:`~django.test.utils.setup_test_environment` installs a template renderer
  331
+which will allow us to examine some additional attributes on responses such as
  332
+``response.context`` that otherwise wouldn't be available. Note that this
  333
+method *does not* setup a test database, so the following will be run against
  334
+the existing database and the output may differ slightly depending on what
  335
+polls you already created.
  336
+
330 337
 Next we need to import the test client class (later in ``tests.py`` we will use
331 338
 the :class:`django.test.TestCase` class, which comes with its own client, so
332 339
 this won't be required)::
12  docs/topics/testing/advanced.txt
@@ -163,10 +163,12 @@ environment first. Django provides a convenience method to do this::
163 163
     >>> from django.test.utils import setup_test_environment
164 164
     >>> setup_test_environment()
165 165
 
166  
-This convenience method sets up the test database, and puts other
167  
-Django features into modes that allow for repeatable testing.
  166
+:func:`~django.test.utils.setup_test_environment` puts several Django features
  167
+into modes that allow for repeatable testing, but does not create the test
  168
+databases; :func:`django.test.simple.DjangoTestSuiteRunner.setup_databases`
  169
+takes care of that.
168 170
 
169  
-The call to :meth:`~django.test.utils.setup_test_environment` is made
  171
+The call to :func:`~django.test.utils.setup_test_environment` is made
170 172
 automatically as part of the setup of ``./manage.py test``. You only
171 173
 need to manually invoke this method if you're not using running your
172 174
 tests via Django's test runner.
@@ -286,7 +288,9 @@ Methods
286 288
 
287 289
 .. method:: DjangoTestSuiteRunner.setup_test_environment(**kwargs)
288 290
 
289  
-    Sets up the test environment ready for testing.
  291
+    Sets up the test environment by calling
  292
+    :func:`~django.test.utils.setup_test_environment` and setting
  293
+    :setting:`DEBUG` to ``False``.
290 294
 
291 295
 .. method:: DjangoTestSuiteRunner.build_suite(test_labels, extra_tests=None, **kwargs)
292 296
 

0 notes on commit acd9dc3

Please sign in to comment.
Something went wrong with that request. Please try again.