Ticket #13662: 13662.combined.diff

File 13662.combined.diff, 5.6 KB (added by Gabriel Grant, 14 years ago)

this patch contains all the changes from the above two patches, as well as a few extra line-length fixes

  • README

    diff --git a/README b/README
    index 6d2ce90..c0d69c7 100644
    a b To contribute to Django:  
    3737
    3838    * Check out http://www.djangoproject.com/community/ for information
    3939      about getting involved.
     40
     41To run Django's included unit tests:
     42
     43    * Follow the instructions in the "Unit tests" section of
     44      docs/internals/contributing.txt, published online at
     45      http://docs.djangoproject.com/en/dev/internals/contributing/#running-the-unit-tests
  • docs/internals/contributing.txt

    diff --git a/docs/internals/contributing.txt b/docs/internals/contributing.txt
    index 5130a01..d5ec2fb 100644
    a b for an explanation of how to write new tests.  
    874874Running the unit tests
    875875----------------------
    876876
    877 To run the tests, ``cd`` to the ``tests/`` directory and type:
     877Quickstart
     878~~~~~~~~~~
     879
     880Running the tests requires a Django settings module that defines the databases
     881to use. To run the tests with the included minimal ``settings`` module, ``cd``
     882to the Django ``tests/`` directory and type:
     883
     884.. code-block:: bash
     885
     886    ./runtests.py --settings=test_sqlite
     887
     888Using the included ``test_sqlite.py`` allows you to get started running the
     889tests against the SQLite database backend without doing anything else on your
     890filesystem. However it should be noted that running against other database
     891backends is recommended for certain types of test cases.
     892
     893If you get an ``ImportError: No module named django.contrib`` error, you need
     894to add your distribution of Django to your ``PYTHONPATH``. This can be done
     895temporarily by symlinking the django directory. To do so, type:
     896
     897.. code-block:: bash
     898
     899    ln -s ../django/ django
     900
     901For more details, and better options if you plan on using this version of
     902Django long-term, read `Pointing Python at the new Django version`_ below.
     903
     904Using another ``settings`` module
     905~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     906
     907To run the tests with different settings, ``cd`` to the ``tests/`` directory
     908and type:
    878909
    879910.. code-block:: bash
    880911
    881912    ./runtests.py --settings=path.to.django.settings
    882913
    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:
     914The :setting:`DATABASES` setting in this test settings module needs to define
     915two databases:
    885916
    886917    * A ``default`` database. This database should use the backend that
    887918      you want to use for primary testing
    info. Your :setting:`DATABASES` setting needs to define two databases:  
    892923      want. It doesn't need to use the same backend as the ``default``
    893924      database (although it can use the same backend if you want to).
    894925
    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:
     926If you're using a backend that isn't SQLite, you will need to provide other
     927details for each database:
    911928
    912929    * The :setting:`USER` option for each of your databases needs to
    913930      specify an existing user account for the database.
    character set. If your database server doesn't use UTF-8 as a default charset,  
    927944you will need to include a value for ``TEST_CHARSET`` in the settings
    928945dictionary for the applicable database.
    929946
     947Running only some of the tests
     948~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     949
     950Django's entire test suite takes a few minutes to run. To run a subset of the
     951unit tests, append the names of the test modules to the ``runtests.py``
     952command line.
     953
     954As an example, if you'd like to only run tests for generic relations and
     955internationalization, type:
     956
     957.. code-block:: bash
     958
     959    ./runtests.py --settings=path.to.settings generic_relations i18n
     960
     961See the list of directories in ``tests/modeltests`` and
     962``tests/regressiontests`` for module names.
     963
     964If you just want to run a particular class of tests, you can specify a list of
     965paths to individual test classes. For example, to run the ``TranslationTests``
     966of the ``i18n`` module, type:
     967
     968.. code-block:: bash
     969
     970    ./runtests.py --settings=path.to.settings i18n.TranslationTests
     971
     972You can specify an individual test like this:
     973
     974.. code-block:: bash
     975
     976    ./runtests.py --settings=path.to.settings i18n.TranslationTests.test_lazy_objects
     977
     978Running all the tests
     979~~~~~~~~~~~~~~~~~~~~~
     980
    930981If you want to run the full suite of tests, you'll need to install a number of
    931982dependencies:
    932983
    associated tests will be skipped.  
    9551006.. _cmemcached: http://gijsbert.org/cmemcache/index.html
    9561007.. _gettext: http://www.gnu.org/software/gettext/manual/gettext.html
    9571008
    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 
    9711009Contrib apps
    9721010------------
    9731011
Back to Top