diff options
| -rw-r--r-- | tests/test_venv.py | 9 | ||||
| -rw-r--r-- | tox/_venv.py | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/tests/test_venv.py b/tests/test_venv.py index 2c3a4b6..204d915 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -205,7 +205,7 @@ def test_install_error(newmocksession): venv = mocksession.getenv('python') venv.test() mocksession.report.expect("error", "*not find*qwelkqw*") - + def test_install_python3(tmpdir, newmocksession): if not py.path.local.sysfind('python3.1'): py.test.skip("needs python3.1") @@ -338,7 +338,7 @@ class TestCreationConfig: mocksession._clearmocks() venv.update() mocksession.report.expect("action", "recreating virtualenv*") - + class TestVenvTest: def test_patchPATH(self, newmocksession, monkeypatch): @@ -371,7 +371,7 @@ class TestVenvTest: assert 'PIP_RESPECT_VIRTUALENV' not in os.environ os.environ['PIP_RESPECT_VIRTUALENV'] = "1" -def test_session_environment_passed_to_pcall(mocksession, newconfig): +def test_session_environment_added_to_pcall(mocksession, newconfig): config = newconfig([], """ [testenv:python] commands=%s -V @@ -392,6 +392,9 @@ def test_session_environment_passed_to_pcall(mocksession, newconfig): assert 'ENV_VAR' in env assert env['ENV_VAR'] == 'value' + for e in os.environ: + assert e in env + def test_install_sdist_upgrade_mode(newmocksession): mocksession = newmocksession([], "") venv = mocksession.getenv('python') diff --git a/tox/_venv.py b/tox/_venv.py index 2ef6933..a723b79 100644 --- a/tox/_venv.py +++ b/tox/_venv.py @@ -232,9 +232,15 @@ class VirtualEnv(object): self.session.make_emptydir(self.envconfig.envtmpdir) cwd = self.envconfig.changedir env = self.envconfig.environment + if env: + env_arg = os.environ.copy() + env_arg.update(env) + else: + env_arg = None + for argv in self.envconfig.commands: try: - self._pcall(argv, log=-1, cwd=cwd, env=env) + self._pcall(argv, log=-1, cwd=cwd, env=env_arg) except tox.exception.InvocationError: self.session.report.error(str(sys.exc_info()[1])) return True |
