Inherit environment variables for tests that use nodeenv

Tox 2.0 stopped automatically passing environment variables into the
virtual environment which potentially breaks test jobs which use nodeenv
because of the nature of running nodeenv within a virtual environment.

The nodeenv documentation (https://pypi.python.org/pypi/nodeenv) even
says:

"
If you already have the python virtualenv tool, and want to use nodeenv
and virtualenv in conjunction, then you should create (or activate) the
python virtual environment:

# in case of using virtualenv_wrapper
$ mkvirtualenv my_env

# in case of using virtualenv
$ . my_env/bin/activate
and add a node virtual environment to this existing new_venv:

$ nodeenv -p
"

Since we can't source {envdir}/bin/activate from within the tox.ini, we
just pass the environment variables into the virtual environment using
passenv = *.

An alternative may be to change run_test.sh to run tests which use
nodeenv within a venv by sourcing $VIRTUAL_ENV/bin/activate from within
run_test.sh.

Closes-Bug: #1458928

Change-Id: Icb91cdc0d4610407c4eeeda82f194c7016e3b540
This commit is contained in:
Matt Riedemann 2015-05-26 12:16:22 -07:00
parent 0d9d1aadd7
commit 22c485b179
1 changed files with 2 additions and 0 deletions

View File

@ -45,11 +45,13 @@ basepython = python2.7
commands = /bin/bash run_tests.sh -N --integration --selenium-headless {posargs}
[testenv:jshint]
passenv = *
commands = nodeenv -p
npm install jshint -g
/bin/bash run_tests.sh -N --jshint
[testenv:jscs]
passenv = *
commands = nodeenv -p
npm install jscs -g
/bin/bash run_tests.sh -N --jscs