File: tests.rst

package info (click to toggle)
python-django-treebeard 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,420 kB
  • sloc: python: 5,315; javascript: 270; makefile: 180; sh: 6
file content (59 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Running the Test Suite
======================

``django-treebeard`` includes a comprehensive test suite. It is highly
recommended that you run and update the test suite when you send patches.

pytest
------

You will need `pytest`_ to run the test suite:

.. code-block:: console

    $ pip install pytest

Then just run the test suite:

.. code-block:: console

    $ pytest

You can use all the features and plugins of pytest this way.

By default the test suite will run using a sqlite3 database in RAM, but you can
change this setting environment variables:

.. option:: DATABASE_USER
.. option:: DATABASE_PASSWORD
.. option:: DATABASE_HOST
.. option:: DATABASE_USER_POSTGRES
.. option:: DATABASE_PORT_POSTGRES
.. option:: DATABASE_USER_MYSQL
.. option:: DATABASE_PORT_MYSQL

   Sets the database settings to be used by the test suite. Useful if you
   want to test the same database engine/version you use in production.


tox
---

``django-treebeard`` uses `tox`_ to run the test suite in all the supported
environments - permutations of:

  - Python 3.8 - 3.11
  - Django 3.2, 4.0 and 4.1
  - Sqlite, MySQL, PostgreSQL and MSSQL

This means that there are a lot of permutations, which takes a long time.
If you want to test only one or a few environments, use the `-e`
option in `tox`_, like:

.. code-block:: console

    $ tox -e py39-dj32-postgres


.. _pytest: http://pytest.org/
.. _tox: https://tox.readthedocs.io/en/latest/index.html