I\'m using following in setenv to import the environment variable from where I run, but is there a way to import all the variables so that I don\'t really need to import one
You can use passenv. If you pass the catch all wildcard *
you have access to all environment variables from the parent environment:
passenv=SPACE-SEPARATED-GLOBNAMES
New in version 2.0.
A list of wildcard environment variable names which shall be copied from the tox invocation environment to the test environment when executing test commands. If a specified environment variable doesn’t exist in the tox invocation environment it is ignored. You can use * and ? to match multiple environment variables with one name.
minimal tox.ini
to reproduce (no project necessary):
[tox]
skipsdist = True
[testenv]
passenv = *
skip_install = True
commands = python -c "print('computer says {env:MY_FANCY_ENV_VAR:}!')"
invocation in linux/unix shell:
MY_FANCY_ENV_VAR=no tox -qq
invocation on Windows cmd.exe:
set MY_FANCY_ENV_VAR=no & tox -qq
output:
computer says no!