summaryrefslogtreecommitdiff
path: root/doc/en/existingtestsuite.rst
blob: 1e3e192bf3fd359e6a55ff76c58e1b38dce535bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.. _existingtestsuite:

Using pytest with an existing test suite
===========================================

Pytest can be used with most existing test suites, but its
behavior differs from other test runners such as :ref:`nose <noseintegration>` or
Python's default unittest framework.

Before using this section you will want to :ref:`install pytest <getstarted>`.

Running an existing test suite with pytest
---------------------------------------------

Say you want to contribute to an existing repository somewhere.
After pulling the code into your development space using some
flavor of version control and (optionally) setting up a virtualenv
you will want to run:

.. code-block:: bash

    cd <repository>
    pip install -e .  # Environment dependent alternatives include
                      # 'python setup.py develop' and 'conda develop'

in your project root.  This will set up a symlink to your code in
site-packages, allowing you to edit your code while your tests
run against it as if it were installed.

Setting up your project in development mode lets you avoid having to
reinstall every time you want to run your tests, and is less brittle than
mucking about with sys.path to point your tests at local code.

Also consider using :ref:`tox <use tox>`.