summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2014-05-10 12:07:33 +0200
committerholger krekel <holger@merlinux.eu>2014-05-10 12:07:33 +0200
commit57aecd1c7f8923c2ed87ada9b7d5c4215181061c (patch)
tree4d99b47a9d7c364650d881d29f48fa77b6edc49d
parent8794480c7b84345c038639325913796810c12eea (diff)
parentecc8d45e048234e7d57b9b7cc14d09d8181d573b (diff)
downloadtox-57aecd1c7f8923c2ed87ada9b7d5c4215181061c.tar.gz
Merged in pmoore/tox (pull request #107)
Return value of locate_via_py was being ignored
-rw-r--r--[-rwxr-xr-x]CHANGELOG11
-rw-r--r--CONTRIBUTORS1
-rw-r--r--tests/test_z_cmdline.py31
-rw-r--r--tox/_cmdline.py21
-rw-r--r--tox/_config.py2
5 files changed, 62 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index e6168cb..55f6689 100755..100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,14 @@
+development
+-----------
+
+- fix issue59: add option "--skip-missing-interpreters" which won't fail the
+ build if Python interpreters listed in tox.ini are missing. Thanks
+ Alexandre Conrad for the PR.
+
+- fix issue164: better traceback info in case of failing test commands.
+ Thanks Marc Abramowitz for the PR.
+
+
1.7.1
---------
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 0244c2b..74557f6 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -23,3 +23,4 @@ Matt Good
Mattieu Agopian
Asmund Grammeltwedt
Ionel Maries Cristian
+Alexandre Conrad
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index 537db5d..283c993 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -191,6 +191,19 @@ def test_minversion(cmd, initproj):
])
assert result.ret
+def test_run_custom_install_command_error(cmd, initproj):
+ initproj("interp123-0.5", filedefs={
+ 'tox.ini': '''
+ [testenv]
+ install_command=./tox.ini {opts} {packages}
+ '''
+ })
+ result = cmd.run("tox")
+ result.stdout.fnmatch_lines([
+ "ERROR: invocation failed, args: ['*/tox.ini*",
+ ])
+ assert result.ret
+
def test_unknown_interpreter_and_env(cmd, initproj):
initproj("interp123-0.5", filedefs={
'tests': {'test_hello.py': "def test_hello(): pass"},
@@ -229,6 +242,22 @@ def test_unknown_interpreter(cmd, initproj):
"*ERROR*InterpreterNotFound*xyz_unknown_interpreter*",
])
+def test_skip_unknown_interpreter(cmd, initproj):
+ initproj("interp123-0.5", filedefs={
+ 'tests': {'test_hello.py': "def test_hello(): pass"},
+ 'tox.ini': '''
+ [testenv:python]
+ basepython=xyz_unknown_interpreter
+ [testenv]
+ changedir=tests
+ '''
+ })
+ result = cmd.run("tox", "--skip-missing-interpreters")
+ assert not result.ret
+ result.stdout.fnmatch_lines([
+ "*SKIPPED*InterpreterNotFound*xyz_unknown_interpreter*",
+ ])
+
def test_unknown_dep(cmd, initproj):
initproj("dep123-0.7", filedefs={
'tests': {'test_hello.py': "def test_hello(): pass"},
@@ -565,7 +594,7 @@ def test_sdistonly(initproj, cmd):
result.stdout.fnmatch_lines([
"*sdist-make*setup.py*",
])
- assert "virtualenv" not in result.stdout.str()
+ assert "-mvirtualenv" not in result.stdout.str()
def test_separate_sdist_no_sdistfile(cmd, initproj):
distshare = cmd.tmpdir.join("distshare")
diff --git a/tox/_cmdline.py b/tox/_cmdline.py
index 192658d..aed71ec 100644
--- a/tox/_cmdline.py
+++ b/tox/_cmdline.py
@@ -92,8 +92,13 @@ class Action(object):
if cwd is None:
# XXX cwd = self.session.config.cwd
cwd = py.path.local()
- popen = self._popen(args, cwd, env=env,
- stdout=f, stderr=STDOUT)
+ try:
+ popen = self._popen(args, cwd, env=env,
+ stdout=f, stderr=STDOUT)
+ except OSError:
+ self.report.error("invocation failed, args: %s, cwd: %s" %
+ (args, cwd))
+ raise
popen.outpath = outpath
popen.args = [str(x) for x in args]
popen.cwd = cwd
@@ -222,6 +227,9 @@ class Reporter(object):
def error(self, msg):
self.logline("ERROR: " + msg, red=True)
+ def skip(self, msg):
+ self.logline("SKIPPED:" + msg, yellow=True)
+
def logline(self, msg, **opts):
self._reportedlines.append(msg)
self.tw.line("%s" % msg, **opts)
@@ -461,7 +469,14 @@ class Session:
retcode = 0
for venv in self.venvlist:
status = venv.status
- if status and status != "skipped tests":
+ if isinstance(status, tox.exception.InterpreterNotFound):
+ msg = " %s: %s" %(venv.envconfig.envname, str(status))
+ if self.config.option.skip_missing_interpreters:
+ self.report.skip(msg)
+ else:
+ retcode = 1
+ self.report.error(msg)
+ elif status and status != "skipped tests":
msg = " %s: %s" %(venv.envconfig.envname, str(status))
self.report.error(msg)
retcode = 1
diff --git a/tox/_config.py b/tox/_config.py
index 2753780..57df84d 100644
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -129,6 +129,8 @@ def prepare_parse(pkgname):
"'pytest<2.7' or 'django>=1.6'.")
parser.add_argument("--sitepackages", action="store_true",
help="override sitepackages setting to True in all envs")
+ parser.add_argument("--skip-missing-interpreters", action="store_true",
+ help="don't fail tests for missing interpreters")
parser.add_argument("args", nargs="*",
help="additional arguments available to command positional substitution")