diff options
| author | Tim Graham <timograham@gmail.com> | 2013-05-20 13:45:32 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-05-20 13:49:11 -0400 |
| commit | 63cab03f6ddd9faa5a770ae08791b2a70aa0a578 (patch) | |
| tree | a3010dcc166618459ffb699e0afd7fc05f096e44 | |
| parent | 0eddedf7db782a05e098c7024a9056aef7283b81 (diff) | |
[1.5.x] Tweaked unit test 'quick start' explanation.
Thanks Jeremy Dunck.
Backport of 490672f057 from master
| -rw-r--r-- | docs/internals/contributing/writing-code/unit-tests.txt | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt index afef554a8c..4a436de795 100644 --- a/docs/internals/contributing/writing-code/unit-tests.txt +++ b/docs/internals/contributing/writing-code/unit-tests.txt @@ -29,15 +29,13 @@ Quickstart Running the tests requires a Django settings module that defines the 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 -with this sample ``settings`` module, ``cd`` into the Django -``tests/`` directory and run: +with this sample ``settings`` module: .. code-block:: bash - ./runtests.py --settings=test_sqlite - -If you get an ``ImportError: No module named django.contrib`` error, -you need to add your install of Django to your ``PYTHONPATH``. + git clone git@github.com:django/django.git django-repo + cd django-repo/tests + PYTHONPATH=..:$PYTHONPATH python ./runtests.py --settings=test_sqlite .. _running-unit-tests-settings: @@ -49,14 +47,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 across databases), you may need to define your own settings file. -To run the tests with different settings, ``cd`` to the ``tests/`` directory -and type: - -.. code-block:: bash - - ./runtests.py --settings=path.to.django.settings +To run the tests with different settings, ensure that the module is on your +``PYTHONPATH`` and pass the module with ``--settings``. -The :setting:`DATABASES` setting in this test settings module needs to define +The :setting:`DATABASES` setting in any test settings module needs to define two databases: * A ``default`` database. This database should use the backend that |
