diff options
author | holger krekel <holger@merlinux.eu> | 2015-06-18 16:07:12 +0200 |
---|---|---|
committer | holger krekel <holger@merlinux.eu> | 2015-06-18 16:07:12 +0200 |
commit | 0c82e9c32d2f0b1209967f774325f0f780f83e97 (patch) | |
tree | 483d1430c17837a114dc1fa641d5319cd51510ee /tox | |
parent | c29c60b2d5d422b50882c0788e17a8f6d7fe1f56 (diff) | |
download | tox-0c82e9c32d2f0b1209967f774325f0f780f83e97.tar.gz |
allow all env variables during installation of dependencies
Diffstat (limited to 'tox')
-rw-r--r-- | tox/__init__.py | 2 | ||||
-rw-r--r-- | tox/config.py | 7 | ||||
-rw-r--r-- | tox/venv.py | 18 |
3 files changed, 18 insertions, 9 deletions
diff --git a/tox/__init__.py b/tox/__init__.py index 2eccc2e..3034588 100644 --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.0.2' +__version__ = '2.1.0.dev1' from .hookspecs import hookspec, hookimpl # noqa diff --git a/tox/config.py b/tox/config.py index 52e0dbc..9026f28 100644 --- a/tox/config.py +++ b/tox/config.py @@ -409,8 +409,11 @@ def tox_addoption(parser): parser.add_testenv_attribute( name="passenv", type="space-separated-list", postprocess=passenv, - help="environment variables names which shall be passed " - "from tox invocation to test environment when executing commands.") + help="environment variables needed during executing test commands " + "(taken from invocation environment). Not that tox always " + "passes in some basic environment variables which are needed for " + "basic functioning of the Python interpreter. See --showconfig " + "for the resulting passenv setting.") parser.add_testenv_attribute( name="whitelist_externals", type="line-list", diff --git a/tox/venv.py b/tox/venv.py index eb2fadc..2f5d583 100644 --- a/tox/venv.py +++ b/tox/venv.py @@ -317,16 +317,22 @@ class VirtualEnv(object): action=action, extraenv=extraenv) def _getenv(self, extraenv={}): - env = {} - for envname in self.envconfig.passenv: - if envname in os.environ: - env[envname] = os.environ[envname] + if extraenv is None: + # for executing tests + env = {} + for envname in self.envconfig.passenv: + if envname in os.environ: + env[envname] = os.environ[envname] + else: + # for executing install commands + env = os.environ.copy() env.update(self.envconfig.setenv) env['VIRTUAL_ENV'] = str(self.path) + if extraenv is not None: + env.update(extraenv) - env.update(extraenv) return env def test(self, redirect=False): @@ -357,7 +363,7 @@ class VirtualEnv(object): try: self._pcall(argv, cwd=cwd, action=action, redirect=redirect, - ignore_ret=ignore_ret) + ignore_ret=ignore_ret, extraenv=None) except tox.exception.InvocationError as err: self.session.report.error(str(err)) self.status = "commands failed" |