mirror of
https://github.com/django/django.git
synced 2025-06-05 11:39:13 +00:00
[1.10.x] Updated "running the tests" to use 'pip install -e'.
Backport of d84ffcc22b2a0dbc0a44a67d56da7e3647e2f87a from master
This commit is contained in:
parent
dda9a5928a
commit
df66aee856
@ -21,28 +21,42 @@ Running the unit tests
|
|||||||
Quickstart
|
Quickstart
|
||||||
----------
|
----------
|
||||||
|
|
||||||
If you are on Python 2, you'll first need to install a backport of the
|
First, `fork Django on GitHub
|
||||||
``unittest.mock`` module that's available in Python 3. See
|
<https://github.com/django/django#fork-destination-box>`__.
|
||||||
:ref:`running-unit-tests-dependencies` for details on installing `mock`_ and
|
|
||||||
the other optional test dependencies.
|
|
||||||
|
|
||||||
Running the tests requires a Django settings module that defines the
|
Second, create and activate a virtual environment. If you're not familiar with
|
||||||
databases to use. To make it easy to get started, Django provides and uses a
|
how to do that, read our :doc:`contributing tutorial </intro/contributing>`.
|
||||||
sample settings module that uses the SQLite database. To run the tests::
|
|
||||||
|
|
||||||
$ 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
|
$ 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
|
.. admonition:: Windows users
|
||||||
|
|
||||||
We recommend something like `Git Bash <https://msysgit.github.io/>`_ to run
|
We recommend something like `Git Bash <https://msysgit.github.io/>`_ to run
|
||||||
the tests using the above approach.
|
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.
|
Having problems? See :ref:`troubleshooting-unit-tests` for some common issues.
|
||||||
|
|
||||||
.. _running-unit-tests-settings:
|
.. _running-unit-tests-settings:
|
||||||
|
@ -111,14 +111,15 @@ Getting a copy of Django's development version
|
|||||||
==============================================
|
==============================================
|
||||||
|
|
||||||
The first step to contributing to Django is to get a copy of the source code.
|
The first step to contributing to Django is to get a copy of the source code.
|
||||||
From the command line, use the ``cd`` command to navigate to the directory
|
First, `fork Django on GitHub <https://github.com/django/django#fork-destination-box>`__.
|
||||||
where you'll want your local copy of Django to live.
|
Then, from the command line, use the ``cd`` command to navigate to the
|
||||||
|
directory where you'll want your local copy of Django to live.
|
||||||
|
|
||||||
Download the Django source code repository using the following command:
|
Download the Django source code repository using the following command:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ git clone https://github.com/django/django.git
|
$ git clone git@github.com:YourGitHubName/django.git
|
||||||
|
|
||||||
Now that you have a local copy of Django, you can install it just like you would
|
Now that you have a local copy of Django, you can install it just like you would
|
||||||
install any package using ``pip``. The most convenient way to do so is by using
|
install any package using ``pip``. The most convenient way to do so is by using
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
To run the test suite::
|
To run the test suite, first, create and activate a virtual environment. Then
|
||||||
|
install some requirements and run the tests::
|
||||||
|
|
||||||
$ cd tests
|
$ cd tests
|
||||||
|
$ pip install -e ..
|
||||||
$ pip install -r requirements/py3.txt # or py2.txt
|
$ pip install -r requirements/py3.txt # or py2.txt
|
||||||
$ PYTHONPATH=..:$PYTHONPATH ./runtests.py
|
$ ./runtests.py
|
||||||
|
|
||||||
For more information about the test suite, see
|
For more information about the test suite, see
|
||||||
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/.
|
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user