Browse files

Fixed #3051 -- Documented the requirements for standalone testing. Th…

…anks to Daniel Roseman for the draft text.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 08277e8 commit 5d4c37af7cedfc78f0f223960e0bfd26f12eaa31 @freakboy3742 freakboy3742 committed Aug 23, 2010
Showing with 18 additions and 0 deletions.
  1. +18 −0 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 ``./ 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 `./ 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

0 comments on commit 5d4c37a

Please sign in to comment.