From e0f22d570e4c242c64e41bb78b4fcfd57fcb79ca Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 9 Dec 2015 12:05:51 +0100 Subject: some small refactorings --- tox/session.py | 2 +- tox/venv.py | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tox/session.py b/tox/session.py index 5c99206..e5e654b 100644 --- a/tox/session.py +++ b/tox/session.py @@ -211,7 +211,7 @@ class Action(object): if sys.platform == "win32": ext = os.path.splitext(str(newargs[0]))[1].lower() if ext == '.py' and self.venv: - newargs = [str(self.venv.getcommandpath())] + newargs + newargs = [str(self.envconfig.envpython)] + newargs return newargs diff --git a/tox/venv.py b/tox/venv.py index 499c6f1..bed7fb7 100644 --- a/tox/venv.py +++ b/tox/venv.py @@ -56,19 +56,29 @@ class VirtualEnv(object): def __init__(self, envconfig=None, session=None): self.envconfig = envconfig self.session = session - self.path = envconfig.envdir - self.path_config = self.path.join(".tox-config1") + + @property + def path(self): + """ Path to environment base dir. """ + return self.envconfig.envdir + + @property + def path_config(self): + return self.path.join(".tox-config1") @property def name(self): + """ test environment name. """ return self.envconfig.envname def __repr__(self): return "" % (self.path) - def getcommandpath(self, name=None, venv=True, cwd=None): - if name is None: - return self.envconfig.envpython + def getcommandpath(self, name, venv=True, cwd=None): + """ return absolute path (str or localpath) for specified + command name. 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 -- cgit v1.2.1