| 1 |
# Tox (http://tox.testrun.org/) is a tool for running tests |
| 2 |
# in multiple virtualenvs. This configuration file will run the |
| 3 |
# test suite on all supported python versions. To use it, "pip install tox" |
| 4 |
# and then run "tox" from this directory. |
| 5 |
|
| 6 |
# To run an individual test environment run e.g. tox -e py38 |
| 7 |
[tox] |
| 8 |
isolated_build = true |
| 9 |
envlist = lint,py{37,38,39,310,311} |
| 10 |
skipsdist=True |
| 11 |
|
| 12 |
|
| 13 |
[testenv] |
| 14 |
deps = |
| 15 |
-rrequirements-tox.txt |
| 16 |
|
| 17 |
commands = |
| 18 |
# Run unittests with coverage |
| 19 |
coverage run tests/runtests.py |
| 20 |
coverage report -m --fail-under 99 |
| 21 |
|
| 22 |
|
| 23 |
[testenv:lint] |
| 24 |
# NOTE: As opposed to above pyXY environments, which run in pythonX.Y, this |
| 25 |
# environment uses the `python` available on the path. |
| 26 |
commands = |
| 27 |
black --check --diff . |
| 28 |
isort --check --diff . |
| 29 |
|
| 30 |
# Run pylint, using the Secure System Lab's pylintrc as base config |
| 31 |
# https://github.com/secure-systems-lab/sample-documents/blob/master/pylintrc |
| 32 |
pylint in_toto |
| 33 |
# Run pylint on tests with required exemptions to allow protected member |
| 34 |
# access (W0212) and test methods that don't use self (R0201). Also be less |
| 35 |
# strict about naming (C0103, C0202), docs (C0111) and line length (C0301). |
| 36 |
pylint tests --disable W0212,R0201,C0103,C0202,C0111,C0301,W0719 |
| 37 |
|
| 38 |
# Run bandit, a security linter from OpenStack Security |
| 39 |
# Exclude files that need special treatment and are tested below |
| 40 |
bandit -r in_toto |