summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-08-23 07:43:50 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-08-23 07:43:50 +0000
commit5d4c37af7cedfc78f0f223960e0bfd26f12eaa31 (patch)
tree57ec25d0c4ce48284f659e20c44089978c4703fd /docs
parent08277e88ac7ae1334dabe4b583c72a0905b8db45 (diff)
Fixed #3051 -- Documented the requirements for standalone testing. Thanks to Daniel Roseman for the draft text.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13626 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/testing.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
index 8e82acc2d4..bfd1ef5e50 100644
--- a/docs/topics/testing.txt
+++ b/docs/topics/testing.txt
@@ -309,6 +309,24 @@ can press ``Ctrl-C`` a second time and the test run will halt immediately,
but not gracefully. No details of the tests run before the interruption will
be reported, and any test databases created by the run will not be destroyed.
+Running tests outside the test runner
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you want to run tests outside of ``./manage.py test`` -- for example,
+from a shell prompt -- you will need to set up the test
+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.
+
+The call to :meth:`~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.
+
The test database
-----------------