3 new commits in tox: https://bitbucket.org/hpk42/tox/commits/25884537a8c8/ Changeset: 25884537a8c8 Branch: skip-missing-interpreter User: aconrad Date: 2014-05-01 08:17:45 Summary: support skipping interpreters if any are missing
This implements the option --skip-missing-interpreters. If this option is passed to tox, the tests won't fail if interpreters are missing. The exit status will be 0 if all tests pass but interpreters were missing. Affected #: 3 files diff -r 0bde778e9e0d234a30d207ddde1abcb1678c170e -r 25884537a8c865b1d6f11531f16b946fa71da499 tests/test_z_cmdline.py --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -229,6 +229,22 @@ "*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 -r 0bde778e9e0d234a30d207ddde1abcb1678c170e -r 25884537a8c865b1d6f11531f16b946fa71da499 tox/_cmdline.py --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -222,6 +222,9 @@ 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 @@ 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 -r 0bde778e9e0d234a30d207ddde1abcb1678c170e -r 25884537a8c865b1d6f11531f16b946fa71da499 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -129,6 +129,8 @@ "'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") https://bitbucket.org/hpk42/tox/commits/b3209345e57a/ Changeset: b3209345e57a Branch: skip-missing-interpreter User: aconrad Date: 2014-05-01 21:12:42 Summary: update CHANGELOG and CONTRIBUTORS Affected #: 2 files diff -r 25884537a8c865b1d6f11531f16b946fa71da499 -r b3209345e57acdcea56283a8a381cd85b6100ad0 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -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 -r 25884537a8c865b1d6f11531f16b946fa71da499 -r b3209345e57acdcea56283a8a381cd85b6100ad0 CONTRIBUTORS --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -23,3 +23,4 @@ Mattieu Agopian Asmund Grammeltwedt Ionel Maries Cristian +Alexandre Conrad https://bitbucket.org/hpk42/tox/commits/b90743edbd42/ Changeset: b90743edbd42 User: hpk42 Date: 2014-05-08 20:46:36 Summary: Merged in aconrad/tox/skip-missing-interpreter (pull request #104) Skip missing interpreters Affected #: 5 files diff -r eb294a76305a09c153b5e21ed5a0c1bc55a3400d -r b90743edbd42cb38b3712688494f6f9948652725 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -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 -r eb294a76305a09c153b5e21ed5a0c1bc55a3400d -r b90743edbd42cb38b3712688494f6f9948652725 CONTRIBUTORS --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -23,3 +23,4 @@ Mattieu Agopian Asmund Grammeltwedt Ionel Maries Cristian +Alexandre Conrad diff -r eb294a76305a09c153b5e21ed5a0c1bc55a3400d -r b90743edbd42cb38b3712688494f6f9948652725 tests/test_z_cmdline.py --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -229,6 +229,22 @@ "*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 -r eb294a76305a09c153b5e21ed5a0c1bc55a3400d -r b90743edbd42cb38b3712688494f6f9948652725 tox/_cmdline.py --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -222,6 +222,9 @@ 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 @@ 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 -r eb294a76305a09c153b5e21ed5a0c1bc55a3400d -r b90743edbd42cb38b3712688494f6f9948652725 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -129,6 +129,8 @@ "'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") 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