<commit_before>==========
Unit tests
==========

Django comes with a test suite of its own, in the ``tests`` directory of the
code base. It's our policy to make sure all tests pass at all times.

The tests cover:

* Models, the database API and everything else in core Django core (``tests/``),
* :ref:`contrib-apps` (``django/contrib/<app>/tests`` or ``tests/<app>_...``).

We appreciate any and all contributions to the test suite!

The Django tests all use the testing infrastructure that ships with Django for
testing applications. See :doc:`/topics/testing/overview` for an explanation of
how to write new tests.

.. _running-unit-tests:

Running the unit tests
----------------------

Quickstart
~~~~~~~~~~

Running the tests requires a Django settings module that defines the
databases to use. To make it easy to get started, Django provides and uses a
sample settings module that uses the SQLite database. To run the tests:

.. code-block:: bash

   $ git clone <EMAIL>:django/django.git django-repo
   $ cd django-repo/tests
   $ PYTHONPATH=..:$PYTHONPATH ./runtests.py

.. versionchanged:: 1.7

Older versions of Django required specifying a settings file:

.. code-block:: bash

   $ PYTHONPATH=..:$PYTHONPATH python ./runtests.py --settings=test_sqlite

``runtests.py`` now uses ``test_sqlite`` by default if settings aren't provided
through either ``--settings`` or :envvar:`DJANGO_SETTINGS_MODULE`.

You can avoid typing the ``PYTHONPATH`` bit each time by adding your Django
checkout to your ``PYTHONPATH`` or by installing the source checkout using pip.
See :ref:`installing-development-version`.

Having problems? See :ref:`troubleshooting-unit-tests` for some common issues.

.. _running-unit-tests-settings:

Using another ``settings`` module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The included settings module allows you to run the test suite using
SQLite. If you want to test behavior using a different database (and<commit_msg>[1.7.x] Fixed #22457 -- Fixed contributing guide w/o github set-up<commit_after>==========
Unit tests
==========

Django comes with a test suite of its own, in the ``tests`` directory of the
code base. It's our policy to make sure all tests pass at all times.

The tests cover:

* Models, the database API and everything else in core Django core (``tests/``),
* :ref:`contrib-apps` (``django/contrib/<app>/tests`` or ``tests/<app>_...``).

We appreciate any and all contributions to the test suite!

The Django tests all use the testing infrastructure that ships with Django for
testing applications. See :doc:`/topics/testing/overview` for an explanation of
how to write new tests.

.. _running-unit-tests:

Running the unit tests
----------------------

Quickstart
~~~~~~~~~~

Running the tests requires a Django settings module that defines the
databases to use. To make it easy to get started, Django provides and uses a
sample settings module that uses the SQLite database. To run the tests:

.. code-block:: bash

   $ git clone https://github.com:django/django.git django-repo
   $ cd django-repo/tests
   $ PYTHONPATH=..:$PYTHONPATH ./runtests.py

.. versionchanged:: 1.7

Older versions of Django required specifying a settings file:

.. code-block:: bash

   $ PYTHONPATH=..:$PYTHONPATH python ./runtests.py --settings=test_sqlite

``runtests.py`` now uses ``test_sqlite`` by default if settings aren't provided
through either ``--settings`` or :envvar:`DJANGO_SETTINGS_MODULE`.

You can avoid typing the ``PYTHONPATH`` bit each time by adding your Django
checkout to your ``PYTHONPATH`` or by installing the source checkout using pip.
See :ref:`installing-development-version`.

Having problems? See :ref:`troubleshooting-unit-tests` for some common issues.

.. _running-unit-tests-settings:

Using another ``settings`` module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The included settings module allows you to run the test suite using
SQLite. If you want to test behavior using a different database (and
{'fraction_non_alphanumeric': 0.1332827516439049, 'fraction_numerical': 0.00278199291856348, 'mean_word_length': 4.18348623853211, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '976412', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1084, 'n_words': 481}