Commits

Gustavo Picon  committed b610cfb

#66: call `$PYTHON $PIP` instead of `pip` when needed

  • Participants
  • Parent commits 429ee63

Comments (0)

Files changed (2)

File tests/test_venv.py

     assert len(l) == 2
     args = l[1].args
     assert l[1].cwd == venv.envconfig.envlogdir
+    if sys.platform != "win32":
+        assert venv.getsupportedinterpreter() == args.pop(0)
     assert "pip" in str(args[0])
     assert args[1] == "install"
     arg = "--download-cache=" + str(venv.envconfig.downloadcache)
     assert len(l) == 2
     args = l[1].args
     assert l[1].cwd == venv.envconfig.envlogdir
+    if sys.platform != "win32":
+        assert venv.getsupportedinterpreter() == args.pop(0)
     assert "pip" in str(args[0])
     assert args[1] == "install"
     arg = "--download-cache=" + str(venv.envconfig.downloadcache)
     venv.install_deps()
     # two different index servers, two calls
     assert len(l) == 3
+
+    if sys.platform != "win32":
+        for pcall in l:
+            assert venv.getsupportedinterpreter() == pcall.args.pop(0)
+
     args = " ".join(l[0].args)
     assert "-i" not in args
     assert "dep1" in args
     venv._install(["hello"], action=action)
     assert len(l) == 1
     args = l[0].args
+    if sys.platform != "win32":
+        assert venv.getsupportedinterpreter() == args.pop(0)
     assert 'pip' in str(args[0])
     for x in args:
         assert "--download-cache" not in args, args
     venv.pip_install(args=["whatever"], action=action)
     l = mocksession._pcalls
     assert len(l) == 1
+    if sys.platform != "win32":
+        assert venv.getsupportedinterpreter() == l[0].args.pop(0)
     assert 'pip' in l[0].args[0]
     assert 'install' in l[0].args
     env = l[0].env

File tox/_venv.py

         self._pcall(argv, cwd=self.envconfig.envlogdir)
 
     def pip_install(self, args, indexserver=None, action=None):
-        argv = ["pip", "install"] + self._commoninstallopts(indexserver)
+        # win32
+        if sys.platform == "win32":
+            argv = ["pip"]
+        else:
+            argv = [
+                self.getsupportedinterpreter(),
+                str(self.envconfig.envbindir.join("pip")),
+            ]
+        argv.append("install")
+        argv += self._commoninstallopts(indexserver)
         if self.envconfig.downloadcache:
             self.envconfig.downloadcache.ensure(dir=1)
             argv.append("--download-cache=%s" %