summaryrefslogtreecommitdiff
path: root/docs/topics/testing.txt
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-02-01 13:00:00 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-02-01 13:00:00 +0000
commit84599495a0332925ceae8e7902eb4cc8bfb3e635 (patch)
tree99e77627a613d40c782b6fab071a1d7ed0a0e085 /docs/topics/testing.txt
parente0dd8a930b38a5a729b52fb85d23d1ad58c35064 (diff)
Fixed #6364 -- Added the ability to run individual doctests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics/testing.txt')
-rw-r--r--docs/topics/testing.txt34
1 files changed, 27 insertions, 7 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
index 9350c5a78c..ecd71ce61a 100644
--- a/docs/topics/testing.txt
+++ b/docs/topics/testing.txt
@@ -261,20 +261,40 @@ Note that we used ``animals``, not ``myproject.animals``.
.. versionadded:: 1.0
You can now choose which test to run.
-If you use unit tests, as opposed to
-doctests, you can be even *more* specific in choosing which tests to execute.
-To run a single test case in an application (for example, the
-``AnimalTestCase`` described in the "Writing unit tests" section), add the
-name of the test case to the label on the command line::
+You can be even *more* specific by naming an individual test case. To
+run a single test case in an application (for example, the
+``AnimalTestCase`` described in the "Writing unit tests" section), add
+the name of the test case to the label on the command line::
$ ./manage.py test animals.AnimalTestCase
-And it gets even more granular than that! To run a *single* test method inside
-a test case, add the name of the test method to the label::
+And it gets even more granular than that! To run a *single* test
+method inside a test case, add the name of the test method to the
+label::
$ ./manage.py test animals.AnimalTestCase.testFluffyAnimals
.. versionadded:: 1.2
+ The ability to select individual doctests was added.
+
+You can use the same rules if you're using doctests. Django will use the
+test label as a path to the test method or class that you want to run.
+If your ``models.py`` or ``tests.py`` has a function with a doctest, or
+class with a class-level doctest, you can invoke that test by appending the
+name of the test method or class to the label::
+
+ $ ./manage.py test animals.classify
+
+If you want to run the doctest for a specific method in a class, add the
+name of the method to the label::
+
+ $ ./manage.py test animals.Classifier.run
+
+If you're using a ``__test__`` dictionary to specify doctests for a
+module, Django will use the label as a key in the ``__test__`` dictionary
+for defined in ``models.py`` and ``tests.py``.
+
+.. versionadded:: 1.2
You can now trigger a graceful exit from a test run by pressing ``Ctrl-C``.
If you press ``Ctrl-C`` while the tests are running, the test runner will