1Running the Test Suite
2======================
3
4``django-treebeard`` includes a comprehensive test suite. It is highly
5recommended that you run and update the test suite when you send patches.
6
7pytest
8------
9
10You will need `pytest`_ to run the test suite:
11
12.. code-block:: console
13
14    $ pip install pytest
15
16Then just run the test suite:
17
18.. code-block:: console
19
20    $ pytest
21
22You can use all the features and plugins of pytest this way.
23
24By default the test suite will run using a sqlite3 database in RAM, but you can
25change this setting environment variables:
26
27.. option:: DATABASE_ENGINE
28.. option:: DATABASE_NAME
29.. option:: DATABASE_USER
30.. option:: DATABASE_PASSWORD
31.. option:: DATABASE_HOST
32.. option:: DATABASE_PORT
33
34   Sets the database settings to be used by the test suite. Useful if you
35   want to test the same database engine/version you use in production.
36
37
38tox
39---
40
41``django-treebeard`` uses `tox`_ to run the test suite in all the supported
42environments - permutations of:
43
44  - Python 3.6, 3.7 and 3.8
45  - Django 2.2, 3.0 and 3.1
46  - Sqlite, MySQL and PostgreSQL
47
48This means that the test suite will run 24 times to test every
49environment supported by ``django-treebeard``. This takes a long time.
50If you want to test only one or a few environments, please use the `-e`
51option in `tox`_, like:
52
53.. code-block:: console
54
55    $ tox -e py36-dj22-pgsql
56
57
58.. _pytest: http://pytest.org/
59.. _coverage: http://nedbatchelder.com/code/coverage/
60.. _tox: http://codespeak.net/tox/
61