Fixed #5430 -- Improved docs for running Django's own unit tests in docs/contributing.txt. Thanks, akaihola

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-09-15 17:44:14 +00:00
parent b7e90a0abd
commit 061ed82b22
1 changed files with 25 additions and 4 deletions

View File

@ -654,10 +654,31 @@ info, with the ``DATABASE_ENGINE`` setting. You will also need a ``ROOT_URLCONF`
setting (its value is ignored; it just needs to be present) and a ``SITE_ID`` setting (its value is ignored; it just needs to be present) and a ``SITE_ID``
setting (any non-zero integer value will do) in order for all the tests to pass. setting (any non-zero integer value will do) in order for all the tests to pass.
The unit tests will not touch your existing databases; they create a new If you're using the ``sqlite3`` database backend, no further settings are
database, called ``django_test_db``, which is deleted when the tests are needed. A temporary database will be created in memory when running the tests.
finished. This means your user account needs permission to execute ``CREATE
DATABASE``. If you're using another backend:
* Your ``DATABASE_USER`` setting needs to specify an existing user account
for the database engine.
* The ``DATABASE_NAME`` setting must be the name of an existing database to
which the given user has permission to connect. The unit tests will not
touch this database; the test runner creates a new database whose name is
``DATABASE_NAME`` prefixed with ``test_``, and this test database is
deleted when the tests are finished. This means your user account needs
permission to execute ``CREATE DATABASE``.
To run a subset of the unit tests, append the names of the test modules to the
``runtests.py`` command line. See the list of directories in
``tests/modeltests`` and ``tests/regressiontests`` for module names.
As an example, if Django is not in your ``PYTHONPATH``, you placed
``settings.py`` in the ``tests/`` directory, and you'd like to only run tests
for generic relations and internationalization, type::
PYTHONPATH=..
./runtests.py --settings=settings generic_relations i18n
Requesting features Requesting features
=================== ===================