summaryrefslogtreecommitdiff
path: root/tox
diff options
context:
space:
mode:
authorMark Hirota <mhirota@impinj.com>2015-02-09 16:30:00 -0800
committerMark Hirota <mhirota@impinj.com>2015-02-09 16:30:00 -0800
commitaa7c071cfde63f9d1da4c0409d77305f970e6924 (patch)
tree38a33086cbfe980cf0b58a089eee54ed9c4762f6 /tox
parentf9c5117ac9ce0866e88f001ef35d7ee56860c64c (diff)
downloadtox-aa7c071cfde63f9d1da4c0409d77305f970e6924.tar.gz
Fix issue #124
Diffstat (limited to 'tox')
-rw-r--r--tox/_cmdline.py4
-rw-r--r--tox/_venv.py17
2 files changed, 16 insertions, 5 deletions
diff --git a/tox/_cmdline.py b/tox/_cmdline.py
index c9e1aa9..d7010da 100644
--- a/tox/_cmdline.py
+++ b/tox/_cmdline.py
@@ -79,7 +79,7 @@ class Action(object):
f.flush()
return f
- def popen(self, args, cwd=None, env=None, redirect=True, returnout=False):
+ def popen(self, args, cwd=None, env=None, redirect=True, returnout=False, ignore_ret=False):
stdout = outpath = None
resultjson = self.session.config.option.resultjson
if resultjson or redirect:
@@ -141,7 +141,7 @@ class Action(object):
ret = popen.wait()
finally:
self._popenlist.remove(popen)
- if ret:
+ if ret and not ignore_ret:
invoked = " ".join(map(str, popen.args))
if outpath:
self.report.error("invocation failed (exit code %d), logfile: %s" %
diff --git a/tox/_venv.py b/tox/_venv.py
index 937a881..6bcb88a 100644
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -345,8 +345,19 @@ class VirtualEnv(object):
message = "commands[%s] | %s" % (i, ' '.join(
[str(x) for x in argv]))
action.setactivity("runtests", message)
+ # check to see if we need to ignore the return code
+ # if so, we need to alter the command line arguments
+ if argv[0].startswith("-"):
+ ignore_ret = True
+ if argv[0] == "-":
+ del argv[0]
+ else:
+ argv[0] = argv[0].lstrip("-")
+ else:
+ ignore_ret = False
+
try:
- self._pcall(argv, cwd=cwd, action=action, redirect=redirect)
+ self._pcall(argv, cwd=cwd, action=action, redirect=redirect, ignore_ret=ignore_ret)
except tox.exception.InvocationError:
val = sys.exc_info()[1]
self.session.report.error(str(val))
@@ -357,7 +368,7 @@ class VirtualEnv(object):
raise
def _pcall(self, args, venv=True, cwd=None, extraenv={},
- action=None, redirect=True):
+ action=None, redirect=True, ignore_ret=False):
for name in ("VIRTUALENV_PYTHON", "PYTHONDONTWRITEBYTECODE"):
try:
del os.environ[name]
@@ -369,7 +380,7 @@ class VirtualEnv(object):
try:
args[0] = self.getcommandpath(args[0], venv, cwd)
env = self._getenv(extraenv)
- return action.popen(args, cwd=cwd, env=env, redirect=redirect)
+ return action.popen(args, cwd=cwd, env=env, redirect=redirect, ignore_ret=ignore_ret)
finally:
os.environ['PATH'] = old