Debian Codegraph @

docs/dev/tests.txt

raw
1 ======================
2 Running the Test Suite
3 ======================
4
5 The easiest way to run the django-filter tests is to check out the source
6 code and create a virtualenv where you can install the test dependencies.
7 Django-filter uses a custom test runner to configure the environment, so a
8 wrapper script is available to set up and run the test suite.
9
10 .. note::
11
12 The following assumes you have `virtualenv`__ and `git`__ installed.
13
14 __ https://virtualenv.pypa.io/en/stable/
15 __ https://git-scm.com
16
17 Clone the repository
18 --------------------
19
20 Get the source code using the following command:
21
22 .. code-block:: bash
23
24 $ git clone https://github.com/carltongibson/django-filter.git
25
26 Switch to the django-filter directory:
27
28 .. code-block:: bash
29
30 $ cd django-filter
31
32 Set up the virtualenv
33 ---------------------
34
35 Create a new virtualenv to run the test suite in:
36
37 .. code-block:: bash
38
39 $ virtualenv venv
40
41 Then activate the virtualenv and install the test requirements:
42
43 .. code-block:: bash
44
45 $ source venv/bin/activate
46 $ pip install -r requirements/test.txt
47
48 Execute the test runner
49 -----------------------
50
51 Run the tests with the runner script:
52
53 .. code-block:: bash
54
55 $ python runtests.py
56
57
58 Test all supported versions
59 ---------------------------
60
61 You can also use the excellent tox testing tool to run the tests against all
62 supported versions of Python and Django. Install tox, and then simply run:
63
64 .. code-block:: bash
65
66 $ pip install tox
67 $ tox
68
69
70 Housekeeping
71 ------------
72
73 The ``isort`` utility is used to maintain module imports. You can either test
74 the module imports with the appropriate `tox` env, or with `isort` directly.
75
76 .. code-block:: bash
77
78 $ pip install tox
79 $ tox -e isort
80
81 # or
82
83 $ pip install isort
84 $ isort --check --diff django_filters tests
85
86 To sort the imports, simply remove the ``--check-only`` option.
87
88 .. code-block:: bash
89
90 $ isort --recursive django_filters tests