mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Prior to this commit our GitHub workflow would set up one Python version only for each build, which means that the commands to run the tests and publish coverage (tox and coveralls) were run with the same Python version as tox runs the tests in. Given that the coveralls CLI tool dropped py2 a couple of releases ago, this commit sets up an additional service py3 to run coveralls (and tox) on when building for py2. To prevent tox from using the wrong Python version to run the tests on, this commit changes the toxenv value from the generic 'py' (uses default python on path) to 'py27'. For convenience and readability we use the environment variable TOXENV instead of the tox -e option. Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
47 lines
1.6 KiB
INI
47 lines
1.6 KiB
INI
# Tox (https://tox.readthedocs.io/en/latest/) is a tool for running tests
|
|
# in multiple virtualenvs. This configuration file will run the
|
|
# test suite on all supported python versions. To use it, "pip install tox"
|
|
# and then run "tox" from this directory.
|
|
|
|
[tox]
|
|
envlist = lint,py{27,36,37,38,39}
|
|
skipsdist = true
|
|
|
|
[testenv]
|
|
# TODO: Consider refactoring the tests to not require the aggregation script
|
|
# being invoked from the `tests` directory. This seems to be the convention and
|
|
# would make use of other testing tools such as coverage/coveralls easier.
|
|
changedir = tests
|
|
|
|
commands =
|
|
python --version
|
|
coverage run aggregate_tests.py
|
|
coverage report -m --fail-under 97
|
|
|
|
deps =
|
|
-r{toxinidir}/requirements-test.txt
|
|
# Install TUF in editable mode, instead of tox default virtual environment
|
|
# installation (see `skipsdist`), to get relative paths in coverage reports
|
|
--editable {toxinidir}
|
|
|
|
# FIXME: use legacy resolver because https://github.com/pypa/pip/issues/9215
|
|
install_command = pip install --use-deprecated=legacy-resolver --pre {opts} {packages}
|
|
|
|
|
|
# Develop test env to run tests against securesystemslib's master branch
|
|
# Must to be invoked explicitly with, e.g. `tox -e with-sslib-master`
|
|
[testenv:with-sslib-master]
|
|
deps =
|
|
git+http://github.com/secure-systems-lab/securesystemslib.git@master#egg=securesystemslib
|
|
-r{toxinidir}/requirements-test.txt
|
|
--editable {toxinidir}
|
|
|
|
commands =
|
|
coverage run aggregate_tests.py
|
|
coverage report -m
|
|
|
|
[testenv:lint]
|
|
commands =
|
|
pylint {toxinidir}/tuf --ignore={toxinidir}/tuf/api
|
|
pylint {toxinidir}/tuf/api --rcfile={toxinidir}/tuf/api/pylintrc
|
|
bandit -r {toxinidir}/tuf
|