7 new commits in tox:

https://bitbucket.org/hpk42/tox/commits/2be7146133cb/
Changeset:   2be7146133cb
Branch:      jtpereyda-cleanup
User:        jtpereyda
Date:        2016-04-14 18:56:58+00:00
Summary:     Created new branch jtpereyda-cleanup
Affected #:  0 files



https://bitbucket.org/hpk42/tox/commits/87e8123dfc61/
Changeset:   87e8123dfc61
Branch:      jtpereyda-cleanup
User:        joshpere
Date:        2016-04-14 18:59:37+00:00
Summary:     Cleanup: Rename local variable for clarity
Affected #:  1 file

diff -r 2be7146133cbccdca10525aab31a32ee53575af9 -r 
87e8123dfc61ccde46337ce664647b685c63d4a9 tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -88,29 +88,29 @@
         if os.path.isabs(name):
             return name
         if os.path.split(name)[0] == ".":
-            p = cwd.join(name)
-            if p.check():
-                return str(p)
-        p = None
+            path = cwd.join(name)
+            if path.check():
+                return str(path)
+        path = None
         if venv:
-            p = py.path.local.sysfind(name, paths=[self.envconfig.envbindir])
-        if p is not None:
-            return p
-        p = py.path.local.sysfind(name)
-        if p is None:
+            path = py.path.local.sysfind(name, 
paths=[self.envconfig.envbindir])
+        if path is not None:
+            return path
+        path = py.path.local.sysfind(name)
+        if path is None:
             raise tox.exception.InvocationError(
                 "could not find executable %r" % (name,))
-        # p is not found in virtualenv script/bin dir
+        # path is not found in virtualenv script/bin dir
         if venv:
-            if not self.is_allowed_external(p):
+            if not self.is_allowed_external(path):
                 self.session.report.warning(
                     "test command found but not installed in testenv\n"
                     "  cmd: %s\n"
                     "  env: %s\n"
                     "Maybe you forgot to specify a dependency? "
                     "See also the whitelist_externals envconfig setting." % (
-                        p, self.envconfig.envdir))
-        return str(p)  # will not be rewritten for reporting
+                        path, self.envconfig.envdir))
+        return str(path)  # will not be rewritten for reporting
 
     def is_allowed_external(self, p):
         tryadd = [""]


https://bitbucket.org/hpk42/tox/commits/afc1016bb733/
Changeset:   afc1016bb733
Branch:      jtpereyda-cleanup
User:        joshpere
Date:        2016-04-14 19:04:20+00:00
Summary:     Cleanup: Format comments for easier reading.
Affected #:  1 file

diff -r 87e8123dfc61ccde46337ce664647b685c63d4a9 -r 
afc1016bb733bdf69233a61315be3c36d3fe4977 tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -79,11 +79,11 @@
         return "<VirtualEnv at %r>" % (self.path)
 
     def getcommandpath(self, name, venv=True, cwd=None):
-        """ return absolute path (str or localpath) for specified
-        command name.  If it's a localpath we will rewrite it as
-        as a relative path.  If venv is True we will check if the
-        command is coming from the venv or is whitelisted to come
-        from external. """
+        """ Return absolute path (str or localpath) for specified command name.
+         - If it's a local path we will rewrite it as as a relative path.
+         - If venv is True we will check if the command is coming from the venv
+           or is whitelisted to come from external.
+        """
         name = str(name)
         if os.path.isabs(name):
             return name


https://bitbucket.org/hpk42/tox/commits/e358f4e8323e/
Changeset:   e358f4e8323e
Branch:      jtpereyda-cleanup
User:        joshpere
Date:        2016-04-14 19:15:42+00:00
Summary:     Cleanup: Extract function for readability. The _venv_lookup 
function is now self-descriptive and more self-contained.
Affected #:  1 file

diff -r afc1016bb733bdf69233a61315be3c36d3fe4977 -r 
e358f4e8323e5ac2bf4478feafbf721f32c094b3 tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -91,17 +91,22 @@
             path = cwd.join(name)
             if path.check():
                 return str(path)
-        path = None
+
         if venv:
-            path = py.path.local.sysfind(name, 
paths=[self.envconfig.envbindir])
-        if path is not None:
-            return path
-        path = py.path.local.sysfind(name)
+            path = self._venv_lookup(name)
+        else:
+            path = py.path.local.sysfind(name)
+
         if path is None:
             raise tox.exception.InvocationError(
                 "could not find executable %r" % (name,))
-        # path is not found in virtualenv script/bin dir
-        if venv:
+
+        return str(path)  # will not be rewritten for reporting
+
+    def _venv_lookup(self, name):
+        path = py.path.local.sysfind(name, paths=[self.envconfig.envbindir])
+        if path is None:
+            path = py.path.local.sysfind(name)
             if not self.is_allowed_external(path):
                 self.session.report.warning(
                     "test command found but not installed in testenv\n"
@@ -110,7 +115,7 @@
                     "Maybe you forgot to specify a dependency? "
                     "See also the whitelist_externals envconfig setting." % (
                         path, self.envconfig.envdir))
-        return str(path)  # will not be rewritten for reporting
+        return path
 
     def is_allowed_external(self, p):
         tryadd = [""]


https://bitbucket.org/hpk42/tox/commits/bd4c60505f35/
Changeset:   bd4c60505f35
Branch:      jtpereyda-cleanup
User:        joshpere
Date:        2016-04-14 19:18:29+00:00
Summary:     Cleanup: Extract duplicate code
Affected #:  1 file

diff -r e358f4e8323e5ac2bf4478feafbf721f32c094b3 -r 
bd4c60505f355dc6093327ac009cefdbdf32dffc tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -95,7 +95,7 @@
         if venv:
             path = self._venv_lookup(name)
         else:
-            path = py.path.local.sysfind(name)
+            path = self._normal_lookup(name)
 
         if path is None:
             raise tox.exception.InvocationError(
@@ -106,7 +106,7 @@
     def _venv_lookup(self, name):
         path = py.path.local.sysfind(name, paths=[self.envconfig.envbindir])
         if path is None:
-            path = py.path.local.sysfind(name)
+            path = self._normal_lookup(name)
             if not self.is_allowed_external(path):
                 self.session.report.warning(
                     "test command found but not installed in testenv\n"
@@ -117,6 +117,9 @@
                         path, self.envconfig.envdir))
         return path
 
+    def _normal_lookup(self, name):
+        return py.path.local.sysfind(name)
+
     def is_allowed_external(self, p):
         tryadd = [""]
         if sys.platform == "win32":


https://bitbucket.org/hpk42/tox/commits/612cfbdc4be1/
Changeset:   612cfbdc4be1
Branch:      jtpereyda-cleanup
User:        joshpere
Date:        2016-04-14 19:32:18+00:00
Summary:     Cleanup: Renaming and method extraction.
Affected #:  1 file

diff -r bd4c60505f355dc6093327ac009cefdbdf32dffc -r 
612cfbdc4be1f5bf43857659f656e49aecf484a3 tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -93,7 +93,7 @@
                 return str(path)
 
         if venv:
-            path = self._venv_lookup(name)
+            path = self._venv_lookup_and_check_external_whitelist(name)
         else:
             path = self._normal_lookup(name)
 
@@ -103,22 +103,29 @@
 
         return str(path)  # will not be rewritten for reporting
 
-    def _venv_lookup(self, name):
-        path = py.path.local.sysfind(name, paths=[self.envconfig.envbindir])
+    def _venv_lookup_and_check_external_whitelist(self, name):
+        path = self._venv_lookup(name)
         if path is None:
             path = self._normal_lookup(name)
-            if not self.is_allowed_external(path):
-                self.session.report.warning(
+            if path is not None:
+                self._check_external_allowed_and_warn(path)
+        return path
+
+    def _venv_lookup(self, name):
+        return py.path.local.sysfind(name, paths=[self.envconfig.envbindir])
+
+    def _normal_lookup(self, name):
+        return py.path.local.sysfind(name)
+
+    def _check_external_allowed_and_warn(self, path):
+        if not self.is_allowed_external(path):
+            self.session.report.warning(
                     "test command found but not installed in testenv\n"
                     "  cmd: %s\n"
                     "  env: %s\n"
                     "Maybe you forgot to specify a dependency? "
                     "See also the whitelist_externals envconfig setting." % (
                         path, self.envconfig.envdir))
-        return path
-
-    def _normal_lookup(self, name):
-        return py.path.local.sysfind(name)
 
     def is_allowed_external(self, p):
         tryadd = [""]


https://bitbucket.org/hpk42/tox/commits/bf8008c08c73/
Changeset:   bf8008c08c73
User:        d6e
Date:        2016-06-20 16:01:01+00:00
Summary:     Merged in jtpereyda/tox/jtpereyda-cleanup (pull request #194)

Cleanup: VirtualEnv.getcommandpath
Affected #:  1 file

diff -r bb377f12d053fb136deb0ba973f2444385acf233 -r 
bf8008c08c7361c18730c458032e875d97a97e90 tox/venv.py
--- a/tox/venv.py
+++ b/tox/venv.py
@@ -79,38 +79,53 @@
         return "<VirtualEnv at %r>" % (self.path)
 
     def getcommandpath(self, name, venv=True, cwd=None):
-        """ return absolute path (str or localpath) for specified
-        command name.  If it's a localpath we will rewrite it as
-        as a relative path.  If venv is True we will check if the
-        command is coming from the venv or is whitelisted to come
-        from external. """
+        """ Return absolute path (str or localpath) for specified command name.
+         - If it's a local path we will rewrite it as as a relative path.
+         - If venv is True we will check if the command is coming from the venv
+           or is whitelisted to come from external.
+        """
         name = str(name)
         if os.path.isabs(name):
             return name
         if os.path.split(name)[0] == ".":
-            p = cwd.join(name)
-            if p.check():
-                return str(p)
-        p = None
+            path = cwd.join(name)
+            if path.check():
+                return str(path)
+
         if venv:
-            p = py.path.local.sysfind(name, paths=[self.envconfig.envbindir])
-        if p is not None:
-            return p
-        p = py.path.local.sysfind(name)
-        if p is None:
+            path = self._venv_lookup_and_check_external_whitelist(name)
+        else:
+            path = self._normal_lookup(name)
+
+        if path is None:
             raise tox.exception.InvocationError(
                 "could not find executable %r" % (name,))
-        # p is not found in virtualenv script/bin dir
-        if venv:
-            if not self.is_allowed_external(p):
-                self.session.report.warning(
+
+        return str(path)  # will not be rewritten for reporting
+
+    def _venv_lookup_and_check_external_whitelist(self, name):
+        path = self._venv_lookup(name)
+        if path is None:
+            path = self._normal_lookup(name)
+            if path is not None:
+                self._check_external_allowed_and_warn(path)
+        return path
+
+    def _venv_lookup(self, name):
+        return py.path.local.sysfind(name, paths=[self.envconfig.envbindir])
+
+    def _normal_lookup(self, name):
+        return py.path.local.sysfind(name)
+
+    def _check_external_allowed_and_warn(self, path):
+        if not self.is_allowed_external(path):
+            self.session.report.warning(
                     "test command found but not installed in testenv\n"
                     "  cmd: %s\n"
                     "  env: %s\n"
                     "Maybe you forgot to specify a dependency? "
                     "See also the whitelist_externals envconfig setting." % (
-                        p, self.envconfig.envdir))
-        return str(p)  # will not be rewritten for reporting
+                        path, self.envconfig.envdir))
 
     def is_allowed_external(self, p):
         tryadd = [""]

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.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to