| 657 | | The unit tests will not touch your existing databases; they create a new |
|---|
| 658 | | database, called ``django_test_db``, which is deleted when the tests are |
|---|
| 659 | | finished. This means your user account needs permission to execute ``CREATE |
|---|
| 660 | | DATABASE``. |
|---|
| | 657 | If you're using the ``sqlite3`` database backend, no further settings are |
|---|
| | 658 | needed. A temporary database will be created in memory when running the tests. |
|---|
| | 659 | |
|---|
| | 660 | If you're using another backend: |
|---|
| | 661 | |
|---|
| | 662 | * Your ``DATABASE_USER`` setting needs to specify an existing user account |
|---|
| | 663 | for the database engine. |
|---|
| | 664 | |
|---|
| | 665 | * The ``DATABASE_NAME`` setting must be the name of an existing database to |
|---|
| | 666 | which the given user has permission to connect. The unit tests will not |
|---|
| | 667 | touch this database; the test runner creates a new database whose name is |
|---|
| | 668 | ``DATABASE_NAME`` prefixed with ``test_``, and this test database is |
|---|
| | 669 | deleted when the tests are finished. This means your user account needs |
|---|
| | 670 | permission to execute ``CREATE DATABASE``. |
|---|
| | 671 | |
|---|
| | 672 | To run a subset of the unit tests, append the names of the test modules to the |
|---|
| | 673 | ``runtests.py`` command line. See the list of directories in |
|---|
| | 674 | ``tests/modeltests`` and ``tests/regressiontests`` for module names. |
|---|
| | 675 | |
|---|
| | 676 | As an example, if Django is not in your ``PYTHONPATH``, you placed |
|---|
| | 677 | ``settings.py`` in the ``tests/`` directory, and you'd like to only run tests |
|---|
| | 678 | for generic relations and internationalization, type:: |
|---|
| | 679 | |
|---|
| | 680 | PYTHONPATH=.. |
|---|
| | 681 | ./runtests.py --settings=settings generic_relations i18n |
|---|