[1.10.x] Updated "running the tests" to use 'pip install -e'.

Backport of d84ffcc22b from master
This commit is contained in:
Tim Graham 2016-10-26 19:15:33 -04:00
parent dda9a5928a
commit df66aee856
3 changed files with 35 additions and 18 deletions

View file

@ -21,28 +21,42 @@ Running the unit tests
Quickstart
----------
If you are on Python 2, you'll first need to install a backport of the
``unittest.mock`` module that's available in Python 3. See
:ref:`running-unit-tests-dependencies` for details on installing `mock`_ and
the other optional test dependencies.
First, `fork Django on GitHub
<https://github.com/django/django#fork-destination-box>`__.
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::
Second, create and activate a virtual environment. If you're not familiar with
how to do that, read our :doc:`contributing tutorial </intro/contributing>`.
$ git clone https://github.com/django/django.git django-repo
Next, clone your fork, install some requirements, and run the tests::
$ git clone git@github.com:YourGitHubName/django.git django-repo
$ cd django-repo/tests
$ PYTHONPATH=..:$PYTHONPATH ./runtests.py
$ pip install -e ..
$ pip install -r requirements/py3.txt # Python 2: py2.txt
$ ./runtests.py
Installing the requirements will likely require some operating system packages
that your computer doesn't have installed. You can usually figure out which
package to install by doing a Web search for the last line or so of the error
message. Try adding your operating system to the search query if needed.
If you have trouble installing the requirements, you can skip that step, except
on Python 2, where you must ``pip install mock``. See
:ref:`running-unit-tests-dependencies` for details on installing the optional
test dependencies. If you don't have an optional dependency installed, the
tests that require it will be skipped.
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. See
:ref:`running-unit-tests-settings` to learn how to use a different settings
module to run the tests with a different database.
.. admonition:: Windows users
We recommend something like `Git Bash <https://msysgit.github.io/>`_ to run
the tests using the above approach.
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: