Tweaked unit test 'quick start' explanation.

Thanks Jeremy Dunck.
This commit is contained in:
Tim Graham 2013-05-20 13:45:32 -04:00
parent 888c86dcf3
commit 490672f057
1 changed files with 7 additions and 13 deletions

View File

@ -27,15 +27,13 @@ Quickstart
Running the tests requires a Django settings module that defines the Running the tests requires a Django settings module that defines the
databases to use. To make it easy to get started, Django provides a databases to use. To make it easy to get started, Django provides a
sample settings module that uses the SQLite database. To run the tests sample settings module that uses the SQLite database. To run the tests
with this sample ``settings`` module, ``cd`` into the Django with this sample ``settings`` module:
``tests/`` directory and run:
.. code-block:: bash .. code-block:: bash
./runtests.py --settings=test_sqlite git clone git@github.com:django/django.git django-repo
cd django-repo/tests
If you get an ``ImportError: No module named django.contrib`` error, PYTHONPATH=..:$PYTHONPATH python ./runtests.py --settings=test_sqlite
you need to add your install of Django to your ``PYTHONPATH``.
.. _running-unit-tests-settings: .. _running-unit-tests-settings:
@ -47,14 +45,10 @@ SQLite. If you want to test behavior using a different database (and
if you're proposing patches for Django, it's a good idea to test if you're proposing patches for Django, it's a good idea to test
across databases), you may need to define your own settings file. across databases), you may need to define your own settings file.
To run the tests with different settings, ``cd`` to the ``tests/`` directory To run the tests with different settings, ensure that the module is on your
and type: ``PYTHONPATH`` and pass the module with ``--settings``.
.. code-block:: bash The :setting:`DATABASES` setting in any test settings module needs to define
./runtests.py --settings=path.to.django.settings
The :setting:`DATABASES` setting in this test settings module needs to define
two databases: two databases:
* A ``default`` database. This database should use the backend that * A ``default`` database. This database should use the backend that