diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-07-20 13:57:49 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-07-20 13:57:49 +0000 |
| commit | 9922a04bb6a9587aee197c6d0e87de9e5bd7e240 (patch) | |
| tree | e3a74e1bf63c638396aeed3f0d5f25e5eb477b7f /docs/testing.txt | |
| parent | 73bec372ee88cf89dce0de3d667b1f7d8291e5fa (diff) | |
Fixed #3782 -- Added support for the suite() method recommended by the Python unittest docs. Thanks for the suggestion, rene.puls@repro-mayr.de.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5729 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/testing.txt')
| -rw-r--r-- | docs/testing.txt | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/docs/testing.txt b/docs/testing.txt index 3839c45c01..0d59ad742c 100644 --- a/docs/testing.txt +++ b/docs/testing.txt @@ -118,10 +118,16 @@ An equivalent unittest test case for the above example would look like:: self.assertEquals(self.lion.speak(), 'The lion says "roar"') self.assertEquals(self.cat.speak(), 'The cat says "meow"') -When you `run your tests`_, the test utility will find all the test cases -(that is, subclasses of ``unittest.TestCase``) in ``models.py`` and -``tests.py``, automatically build a test suite out of those test cases, -and run that suite. +When you `run your tests`_, the default behavior of the test utility is +to find all the test cases (that is, subclasses of ``unittest.TestCase``) +in ``models.py`` and ``tests.py``, automatically build a test suite out of +those test cases, and run that suite. + +However, if you define a method called ``suite()`` in either ``models.py`` or +``tests.py``, that method will be used to construct the test suite for that +module. This follows the `suggested organization`_ for unit tests. See the +Python documentation for more details on how to construct a complex test +suite. For more details about ``unittest``, see the `standard library unittest documentation`_. @@ -129,6 +135,7 @@ documentation`_. .. _unittest: http://docs.python.org/lib/module-unittest.html .. _standard library unittest documentation: unittest_ .. _run your tests: `Running tests`_ +.. _suggested organization: http://docs.python.org/lib/organizing-tests.html Which should I use? ------------------- |
