diff options
author | Ionel Maries Cristian <contact@ionelmc.ro> | 2014-01-11 17:59:44 +0200 |
---|---|---|
committer | Ionel Maries Cristian <contact@ionelmc.ro> | 2014-01-11 17:59:44 +0200 |
commit | be2f2f58807fbcf15602b169d4057b6589cbbf79 (patch) | |
tree | ca11e4534288e51e8797d984085577e640ba5cf6 | |
parent | 1f2afb3f66e812308cd5d30590448a7fdd84295a (diff) | |
download | tox-be2f2f58807fbcf15602b169d4057b6589cbbf79.tar.gz |
Change tox to use the virtualenv bin instead of invoking it with the current interpreter. Virtualenv might have been installed with a completely different interpreter (and might not work at all!) or it could have other issues caused by invoking the module directly (virtualenv 1.11 known to break). Also add a `virtualenvbin` config option in case it need overriding.
-rw-r--r-- | tests/test_venv.py | 7 | ||||
-rw-r--r-- | tox/_config.py | 2 | ||||
-rw-r--r-- | tox/_venv.py | 7 |
3 files changed, 4 insertions, 12 deletions
diff --git a/tests/test_venv.py b/tests/test_venv.py index 0ac8f90..77181d1 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -48,11 +48,8 @@ def test_create(monkeypatch, mocksession, newconfig): l = mocksession._pcalls assert len(l) >= 1 args = l[0].args - assert "virtualenv" in str(args[1]) + assert str(args[0]).endswith("virtualenv") if sys.platform != "win32": - # realpath is needed for stuff like the debian symlinks - assert py.path.local(sys.executable).realpath() \ - == py.path.local(args[0]).realpath() #assert Envconfig.toxworkdir in args assert venv.getcommandpath("easy_install", cwd=py.path.local()) interp = venv._getliveconfig().python @@ -321,7 +318,7 @@ def test_install_python3(tmpdir, newmocksession): l = mocksession._pcalls assert len(l) == 1 args = l[0].args - assert str(args[1]).endswith('virtualenv.py') + assert str(args[0]).endswith('virtualenv') l[:] = [] action = mocksession.newaction(venv, "hello") venv._install(["hello"], action=action) diff --git a/tox/_config.py b/tox/_config.py index 6006fa9..928305c 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -357,6 +357,7 @@ class parseini: ixserver = None name = self._replace_forced_dep(name, config) vc.deps.append(DepConfig(name, ixserver)) + vc.virtualenvbin = reader.getdefault(section, "virtualenvbin", "virtualenv") vc.distribute = reader.getbool(section, "distribute", False) vc.sitepackages = self.config.option.sitepackages or \ reader.getbool(section, "sitepackages", False) @@ -734,4 +735,3 @@ def getcontextname(): if 'HUDSON_URL' in os.environ: return 'jenkins' return None - diff --git a/tox/_venv.py b/tox/_venv.py index 58093fc..4ed7b47 100644 --- a/tox/_venv.py +++ b/tox/_venv.py @@ -178,13 +178,8 @@ class VirtualEnv(object): if action is None: action = self.session.newaction(self, "create") - interpreters = self.envconfig.config.interpreters config_interpreter = self.getsupportedinterpreter() - info = interpreters.get_info(executable=config_interpreter) - f, path, _ = py.std.imp.find_module("virtualenv") - f.close() - venvscript = path.rstrip("co") - args = [config_interpreter, str(venvscript)] + args = [self.envconfig.virtualenvbin] if self.envconfig.distribute: args.append("--distribute") else: |