diff --git a/README b/README
index 6d2ce90..230b2e7 100644
a
|
b
|
To contribute to Django:
|
37 | 37 | |
38 | 38 | * Check out http://www.djangoproject.com/community/ for information |
39 | 39 | about getting involved. |
| 40 | |
| 41 | To run Django's included unit tests: |
| 42 | |
| 43 | * Follow the instructions in the section "Unit tests" in |
| 44 | docs/faq/contributing.txt, published online at http://docs.djangoproject.com/en/dev/internals/contributing/#claiming-tickets#unit-tests |
| 45 | No newline at end of file |
diff --git a/docs/internals/contributing.txt b/docs/internals/contributing.txt
index 5130a01..9d8827f 100644
a
|
b
|
for an explanation of how to write new tests.
|
874 | 874 | Running the unit tests |
875 | 875 | ---------------------- |
876 | 876 | |
877 | | To run the tests, ``cd`` to the ``tests/`` directory and type: |
| 877 | Quickstart |
| 878 | ~~~~~~~~~~ |
| 879 | |
| 880 | Running the tests requires a Django settings module that defines the databases to |
| 881 | use. To run the tests with the included minimal ``settings`` module, ``cd`` to the |
| 882 | Django ``tests/`` directory and type: |
| 883 | |
| 884 | .. code-block:: bash |
| 885 | |
| 886 | ./runtests.py --settings=test_sqlite |
| 887 | |
| 888 | Using the included ``test_sqlite.py`` allows you to get started running the tests |
| 889 | against the SQLite database backend without doing anything else on your |
| 890 | filesystem. However it should be noted that running against other database |
| 891 | backends is recommended for certain types of test cases. |
| 892 | |
| 893 | If you get an ``ImportError: No module named django.contrib`` error, you need to add your distribution of Django to your ``PYTHONPATH`` - see `Pointing Python at the new Django version`_ below. |
| 894 | |
| 895 | Using another ``settings`` module |
| 896 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 897 | |
| 898 | To run the tests with different settings, ``cd`` to the ``tests/`` directory and type: |
878 | 899 | |
879 | 900 | .. code-block:: bash |
880 | 901 | |
881 | 902 | ./runtests.py --settings=path.to.django.settings |
882 | 903 | |
883 | | Yes, the unit tests need a settings module, but only for database connection |
884 | | info. Your :setting:`DATABASES` setting needs to define two databases: |
| 904 | The :setting:`DATABASES` setting in this test settings module needs to define two |
| 905 | databases: |
885 | 906 | |
886 | 907 | * A ``default`` database. This database should use the backend that |
887 | 908 | you want to use for primary testing |
… |
… |
info. Your :setting:`DATABASES` setting needs to define two databases:
|
892 | 913 | want. It doesn't need to use the same backend as the ``default`` |
893 | 914 | database (although it can use the same backend if you want to). |
894 | 915 | |
895 | | As a convenience, a minimal settings file, using two in memory SQLite |
896 | | databases, is included in your Django distribution. It is called |
897 | | ``test_sqlite``, and is included in the ``tests`` directory. This allows you to |
898 | | get started running the tests against the sqlite database without doing |
899 | | anything on your filesystem. However it should be noted that running against |
900 | | other database backends is recommended for certain types of test cases. |
901 | | |
902 | | To run the tests with this included settings file, ``cd`` |
903 | | to the ``tests/`` directory and type: |
904 | | |
905 | | .. code-block:: bash |
906 | | |
907 | | ./runtests.py --settings=test_sqlite |
908 | | |
909 | | If you're using another backend, you will need to provide other details for |
910 | | each database: |
| 916 | If you're using a backend that isn't SQLite, you will need to provide other |
| 917 | details for each database: |
911 | 918 | |
912 | 919 | * The :setting:`USER` option for each of your databases needs to |
913 | 920 | specify an existing user account for the database. |
… |
… |
character set. If your database server doesn't use UTF-8 as a default charset,
|
927 | 934 | you will need to include a value for ``TEST_CHARSET`` in the settings |
928 | 935 | dictionary for the applicable database. |
929 | 936 | |
| 937 | Running only some of the tests |
| 938 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 939 | |
| 940 | Django's entire test suite takes a few minutes to run. To run a subset of the unit |
| 941 | tests, append the names of the test modules to the ``runtests.py`` command line. |
| 942 | |
| 943 | As an example, if you'd like to only run tests for generic relations and internationalization, type: |
| 944 | |
| 945 | .. code-block:: bash |
| 946 | |
| 947 | ./runtests.py --settings=path.to.settings generic_relations i18n |
| 948 | |
| 949 | See the list of directories in ``tests/modeltests`` and ``tests/regressiontests`` |
| 950 | for module names. |
| 951 | |
| 952 | If you just want to run a particular class of tests, you can specify a list of paths to individual test classes. For example, to run the ``TranslationTests`` of the ``i18n`` module, type: |
| 953 | |
| 954 | .. code-block:: bash |
| 955 | |
| 956 | ./runtests.py --settings=path.to.settings i18n.TranslationTests |
| 957 | |
| 958 | You can specify an individual test like this: |
| 959 | |
| 960 | .. code-block:: bash |
| 961 | |
| 962 | ./runtests.py --settings=path.to.settings i18n.TranslationTests.test_lazy_objects |
| 963 | |
| 964 | Running all the tests |
| 965 | ~~~~~~~~~~~~~~~~~~~~~ |
| 966 | |
930 | 967 | If you want to run the full suite of tests, you'll need to install a number of |
931 | 968 | dependencies: |
932 | 969 | |
… |
… |
associated tests will be skipped.
|
955 | 992 | .. _cmemcached: http://gijsbert.org/cmemcache/index.html |
956 | 993 | .. _gettext: http://www.gnu.org/software/gettext/manual/gettext.html |
957 | 994 | |
958 | | To run a subset of the unit tests, append the names of the test modules to the |
959 | | ``runtests.py`` command line. See the list of directories in |
960 | | ``tests/modeltests`` and ``tests/regressiontests`` for module names. |
961 | | |
962 | | As an example, if Django is not in your ``PYTHONPATH``, you placed |
963 | | ``settings.py`` in the ``tests/`` directory, and you'd like to only run tests |
964 | | for generic relations and internationalization, type: |
965 | | |
966 | | .. code-block:: bash |
967 | | |
968 | | PYTHONPATH=`pwd`/.. |
969 | | ./runtests.py --settings=settings generic_relations i18n |
970 | | |
971 | 995 | Contrib apps |
972 | 996 | ------------ |
973 | 997 | |