2 ms·
This combined with tox is great for Python projects in particular. Tox automates creating virtualenvs for the right Python versions you want to test with then r
by globular-toast 3y ago
This combined with tox is great for Python projects in particular. Tox automates creating virtualenvs for the right Python versions you want to test with then running your tests in them. It can also run static checks by issuing `skip_install = True` because you want to test the source code itself. You just need to run this in a Python container that has tox installed as a globally available tool and all versions of Python available in it (like https://github.com/georgek/docker-python-multiversion https://github.com/georgek/docker-python-multiversion <-- not maintained but easy to update).
Here's some boilerplate to do all that:
[tox]
envlist = py{310,311}
[testenv]
passenv =
PIP_CACHE_DIR
deps = coverage # deps only for tox
extras = testing # testing extras include pytest
commands = pytest ...
[testenv:check]
passenv =
PIP_CACHE_DIR
PRE_COMMIT_HOME
skip_install = True
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure