[Pytest-commit] commit/tox: hpk42: fix issue130: you can now set install_command=easy_install {opts} {packages}

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Oct 24 09:38:51 CEST 2013


1 new commit in tox:

https://bitbucket.org/hpk42/tox/commits/eb83611a8e03/
Changeset:   eb83611a8e03
User:        hpk42
Date:        2013-10-24 09:38:45
Summary:     fix issue130: you can now set install_command=easy_install {opts} {packages}
and expect it to run without the need to recreate.  Thanks jenisys for
precise reporting.
Affected #:  3 files

diff -r ca1c1d8f95869a3ca6e4af9fb3f84779e84438b8 -r eb83611a8e03c7f61d1a43d86cc79f4578baa64e CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
 1.6.2.dev
 ---------
 
+- fix issue130: you can now set install_command=easy_install {opts} {packages}
+  and expect it to run without the need to recreate.  Thanks jenisys for
+  precise reporting. 
+
 - fix issue129: tox now uses Popen(..., universal_newlines=True) to force 
   creation of unicode stdout/stderr streams.  fixes a problem on specific
   platform configs when creating virtualenvs with Python3.3. Thanks Jorgen Schäfer

diff -r ca1c1d8f95869a3ca6e4af9fb3f84779e84438b8 -r eb83611a8e03c7f61d1a43d86cc79f4578baa64e tests/test_venv.py
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -520,8 +520,10 @@
     mocksession.installpkg(venv, pkg)
     l = mocksession._pcalls
     assert len(l) == 1
-    assert '-U' in l[0].args
-    assert '--no-deps' in l[0].args
+    index = l[0].args.index(str(pkg))
+    assert index >= 0
+    assert '-U' in l[0].args[:index]
+    assert '--no-deps' in l[0].args[:index]
 
 def test_run_install_command(newmocksession):
     mocksession = newmocksession([], "")
@@ -529,7 +531,7 @@
     venv.just_created = True
     venv.envconfig.envdir.ensure(dir=1)
     action = mocksession.newaction(venv, "hello")
-    venv.run_install_command(args=["whatever"], action=action)
+    venv.run_install_command(packages=["whatever"], action=action)
     l = mocksession._pcalls
     assert len(l) == 1
     assert 'pip' in l[0].args[0]
@@ -548,7 +550,7 @@
     venv.just_created = True
     venv.envconfig.envdir.ensure(dir=1)
     action = mocksession.newaction(venv, "hello")
-    venv.run_install_command(args=["whatever"], action=action)
+    venv.run_install_command(packages=["whatever"], action=action)
     l = mocksession._pcalls
     assert len(l) == 1
     assert 'easy_install' in l[0].args[0]

diff -r ca1c1d8f95869a3ca6e4af9fb3f84779e84438b8 -r eb83611a8e03c7f61d1a43d86cc79f4578baa64e tox/_venv.py
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -280,17 +280,18 @@
             l.append("--download-cache=%s" % self.envconfig.downloadcache)
         return l
 
-    def run_install_command(self, args, indexserver=None, action=None,
+    def run_install_command(self, packages, options=(),
+                            indexserver=None, action=None,
                             extraenv=None):
         argv = self.envconfig.install_command[:]
         # use pip-script on win32 to avoid the executable locking
         if argv[0] == "pip" and sys.platform == "win32":
             argv[0] = "pip-script.py"
         i = argv.index('{packages}')
-        argv[i:i+1] = args
+        argv[i:i+1] = packages
         if '{opts}' in argv:
             i = argv.index('{opts}')
-            argv[i:i+1] = self._installopts(indexserver)
+            argv[i:i+1] = list(options)
         for x in ('PIP_RESPECT_VIRTUALENV', 'PIP_REQUIRE_VIRTUALENV'):
             try:
                 del os.environ[x]
@@ -320,7 +321,6 @@
                 l.append(ixserver)
             assert ixserver.url is None or isinstance(ixserver.url, str)
 
-        extraopts = extraopts or []
         for ixserver in l:
             if self.envconfig.config.option.sethome:
                 extraenv = hack_home_env(
@@ -329,9 +329,12 @@
             else:
                 extraenv = {}
 
-            args = d[ixserver] + extraopts
-            self.run_install_command(args, ixserver.url, action,
-                                     extraenv=extraenv)
+            packages = d[ixserver]
+            options = self._installopts(ixserver.url)
+            if extraopts:
+                options.extend(extraopts)
+            self.run_install_command(packages=packages, options=options,
+                                     action=action, extraenv=extraenv)
 
     def _getenv(self):
         env = self.envconfig.setenv

Repository URL: https://bitbucket.org/hpk42/tox/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the pytest-commit mailing list