diff options
| -rwxr-xr-x | CHANGELOG | 6 | ||||
| -rw-r--r-- | CONTRIBUTORS | 1 | ||||
| -rw-r--r-- | tests/test_z_cmdline.py | 16 | ||||
| -rw-r--r-- | tox/_cmdline.py | 12 | ||||
| -rw-r--r-- | tox/_config.py | 2 |
5 files changed, 36 insertions, 1 deletions
@@ -1,3 +1,9 @@ +development +----------- + +- fix issue59: add option "--skip-missing-interpreters" which won't fail the + build if Python interpreters listed in tox.ini are missing. + 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 2e10c24..53fef28 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -229,6 +229,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"}, diff --git a/tox/_cmdline.py b/tox/_cmdline.py index 192658d..5d58a18 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -222,6 +222,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 +464,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") |
