summaryrefslogtreecommitdiff
path: root/docs/internals/contributing/writing-code/unit-tests.txt
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-10-26 19:15:33 -0400
committerTim Graham <timograham@gmail.com>2016-10-27 08:18:56 -0400
commitd84ffcc22b2a0dbc0a44a67d56da7e3647e2f87a (patch)
tree0d64dac1aedd20d67713ca882b2b5870956f2d08 /docs/internals/contributing/writing-code/unit-tests.txt
parentc74378bb77db5bbeac1bd48c0cd31154f96a81d6 (diff)
Updated "running the tests" to use 'pip install -e'.
Diffstat (limited to 'docs/internals/contributing/writing-code/unit-tests.txt')
-rw-r--r--docs/internals/contributing/writing-code/unit-tests.txt40
1 files changed, 27 insertions, 13 deletions
diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt
index 6799b31871..d5fdb72561 100644
--- a/docs/internals/contributing/writing-code/unit-tests.txt
+++ b/docs/internals/contributing/writing-code/unit-tests.txt
@@ -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 tests using ``tox``