| | 213 | |
|---|
| | 214 | Unit tests |
|---|
| | 215 | ========== |
|---|
| | 216 | |
|---|
| | 217 | Django comes with a test suite of its own, in the ``tests`` directory of the |
|---|
| | 218 | Django tarball. It's our policy to make sure all tests pass at all times. |
|---|
| | 219 | |
|---|
| | 220 | The tests cover: |
|---|
| | 221 | |
|---|
| | 222 | * Models and the database API (``tests/testapp/models``). |
|---|
| | 223 | * The cache system (``tests/otherthests/cache.py``). |
|---|
| | 224 | * The ``django.utils.dateformat`` module (``tests/othertests/dateformat.py``). |
|---|
| | 225 | * Database typecasts (``tests/othertests/db_typecasts.py``). |
|---|
| | 226 | * The template system (``tests/othertests/templates.py`` and |
|---|
| | 227 | ``tests/othertests/defaultfilters.py``). |
|---|
| | 228 | * ``QueryDict`` objects (``tests/othertests/httpwrappers.py``). |
|---|
| | 229 | * Markup template tags (``tests/othertests/markup.py``). |
|---|
| | 230 | * The ``django.utils.timesince`` module (``tests/othertests/timesince.py``). |
|---|
| | 231 | |
|---|
| | 232 | We appreciate any and all contributions to the test suite! |
|---|
| | 233 | |
|---|
| | 234 | Running the unit tests |
|---|
| | 235 | ---------------------- |
|---|
| | 236 | |
|---|
| | 237 | To run the tests, ``cd`` to the ``tests/`` directory and type:: |
|---|
| | 238 | |
|---|
| | 239 | ./runtests.py --settings=path.to.django.settings |
|---|
| | 240 | |
|---|
| | 241 | Yes, the unit tests need a settings module, but only for database connection |
|---|
| | 242 | info -- the ``DATABASE_ENGINE``, ``DATABASE_USER`` and ``DATABASE_PASSWORD``. |
|---|
| | 243 | The unit tests will not touch your database; they create a new database, called |
|---|
| | 244 | ``django_test_db``, which is deleted when the tests are finished. |
|---|