Environment variable

282 views Asked by At

I have a tox.ini file like this:

[tox]
envlist =
    {py27,py34}

[testenv]
setenv =
    PYTHONDONTWRITEBYTECODE=1
deps =
    -r{toxinidir}/requirements-test.txt
commands =
    nosetests -v --stop --with-coverage --cover-package=project

So, I need to pass to my tox env an environment variable from my SO. This variable is private and changes according to the environment.

How I do it?

1

There are 1 answers

0
Jair Henrique On

I found the solution! Tox 2.0 has a settings called passenv

A list of wildcard environment variable names which shall be copied from the tox invocation environment to the test environment. 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. Note that the PATH and PIP_INDEX_URL variables are unconditionally passed down and on Windows SYSTEMROOT, PATHEXT, TEMP and TMP will be passed down as well whereas on unix TMPDIR will be passed down. You can override these variables with the setenv option.