Ticket #12191: testpackage.diff
File testpackage.diff, 1.8 KB (added by , 15 years ago) |
---|
-
docs/topics/testing.txt
101 101 application-level doctests in the module docstring and model-level 102 102 doctests in the model docstrings. 103 103 104 * A file called ``tests.py`` in the application directory -- i.e., the 105 directory that holds ``models.py``. This file is a hook for any and all 106 doctests you want to write that aren't necessarily related to models. 104 * A Python package called ``tests`` in the application directory -- i.e., 105 the directory that holds ``models.py``. This can either be a plain 106 ``tests.py`` file, or a directory with a ``__init__.py`` file where 107 separate classes are imported from the files in that directory. The 108 tests in this package don't have to be related to models. Read Python's 109 official documentation for details on packages_. 107 110 111 .. _packages: http://docs.python.org/tutorial/modules.html#packages 112 108 113 Here is an example model doctest:: 109 114 110 115 # models.py … … 163 168 * The ``models.py`` file. The test runner looks for any subclass of 164 169 ``unittest.TestCase`` in this module. 165 170 166 * A file called ``tests.py`` in the application directory -- i.e., the167 directory that holds ``models.py``. Again, the test runner looks for any168 subclass of ``unittest.TestCase`` in this module.171 * A Python package_ called ``tests`` in the application directory -- 172 i.e., the directory that holds ``models.py``. Again, the test runner 173 looks for any subclass of ``unittest.TestCase`` in this module. 169 174 175 .. _package: http://docs.python.org/tutorial/modules.html#packages 176 170 177 This example ``unittest.TestCase`` subclass is equivalent to the example given 171 178 in the doctest section above:: 172 179