Ticket #12191: testpackage.diff

File testpackage.diff, 1.8 KB (added by mapleoin, 15 years ago)

documentation patch

  • docs/topics/testing.txt

     
    101101      application-level doctests in the module docstring and model-level
    102102      doctests in the model docstrings.
    103103
    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_.
    107110
     111.. _packages: http://docs.python.org/tutorial/modules.html#packages
     112
    108113Here is an example model doctest::
    109114
    110115    # models.py
     
    163168    * The ``models.py`` file. The test runner looks for any subclass of
    164169      ``unittest.TestCase`` in this module.
    165170
    166     * A file called ``tests.py`` in the application directory -- i.e., the
    167       directory that holds ``models.py``. Again, the test runner looks for any
    168       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.
    169174
     175.. _package: http://docs.python.org/tutorial/modules.html#packages
     176
    170177This example ``unittest.TestCase`` subclass is equivalent to the example given
    171178in the doctest section above::
    172179
Back to Top