I have the following tox.ini
file:
[tox]
envlist = flake8,py{35,36,37,38}{,-keyring}
[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
deps =
.[test]
keyring: .[keyring]
setenv =
COVERAGE_FILE = .coverage.{envname}
commands=
pytest {toxinidir}/tests -n 4 {posargs}
[testenv:flake8]
basepython = python3
deps = flake8
commands=
flake8 src tests
[flake8]
ignore: F401,E402,E501,W605,W503
When I run the tox
command, it creates a .tox
folder containing a folder for every environment specified in the [tox]
section of the tox.ini
.
I would like to get read automatically of these particular folders after the test have succeeded when running tox
without having to manually run rm -rf .tox/NAME_OF_THE_ENV
. I have searched through the tox documentation but I have found nothing.
Is it possible to do so? If yes, how?
[tox]envlist is only a default — a list of environments to run when tox is invoked without option -e and without TOXENV environment variable. Once you use tox -e [tox]envlist is ignored. You can run local environment with different python versions, but I don't know any way to run it multiple times.
What is tox? Tox is a tool that creates virtual environments, and installs the configured dependencies for those environments, for the purpose of testing a Python package (i.e. something that will be shared via PyPi, and so it only works with code that defines a setup.py ).
I know it's not exactly what you were asking for but it's worth mentioning that the -r / --recreate
flag to tox will force recreation of virtual environments
There is no way in tox
. The reason is that tox
preserves these environments as a cache: next time you run tox
the environments will be reused thus saving time.
You can remove them at once after running tox
with rm -rf .tox
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With