From 2cd6b250355d795f87c6d05487b5983900617b1a Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 3 Apr 2014 14:39:22 -0700 Subject: Log more info when catch OSError while doing a popen Fixes: https://bitbucket.org/hpk42/tox/issue/164/if-install_command-raises-an-oserror-get-a --- tox/_cmdline.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tox/_cmdline.py b/tox/_cmdline.py index 7c6cd69..04296c4 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -93,8 +93,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 -- cgit v1.2.1 -- cgit v1.2.1 From 0b808e4640861a1f5196201db99a865839781e48 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Mon, 28 Apr 2014 23:19:28 -0700 Subject: Add test_run_custom_install_command_error --- tests/test_z_cmdline.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 343c142..bdbd1ea 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -193,6 +193,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"}, -- cgit v1.2.1 From 3bd552c799ea29f90eb6a759cd4270a9681bc55d Mon Sep 17 00:00:00 2001 From: Alexandre Conrad Date: Wed, 30 Apr 2014 17:22:37 -0700 Subject: make test more specific, less prone to failures Checking for the non-existence of the string "virtualenv" could fail because paths may contain the word virtualenv. --- tests/test_z_cmdline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 537db5d..2e10c24 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -565,7 +565,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") -- cgit v1.2.1 From ecd8e2fc9d278b099464e8b835e31146971eaa9b Mon Sep 17 00:00:00 2001 From: Alexandre Conrad Date: Wed, 30 Apr 2014 23:17:45 -0700 Subject: 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. --- tests/test_z_cmdline.py | 16 ++++++++++++++++ tox/_cmdline.py | 12 +++++++++++- tox/_config.py | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 537db5d..6d2575f 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") -- cgit v1.2.1 From 33f11ebdcbe4da15449fcaac3ef6e3a7f4839a12 Mon Sep 17 00:00:00 2001 From: Alexandre Conrad Date: Thu, 1 May 2014 12:12:42 -0700 Subject: update CHANGELOG and CONTRIBUTORS --- CHANGELOG | 6 ++++++ CONTRIBUTORS | 1 + 2 files changed, 7 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index e6168cb..99b24c9 100755 --- 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 --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 -- cgit v1.2.1 From d3e444560eb36b9c69f35eeb3fb9174a1498e3cc Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 8 May 2014 21:04:03 +0200 Subject: fix issue59 -- add --skip-if-missing-interpreter. Thanks Alexandre Conrad for the PR. --- CHANGELOG | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 99b24c9..8afc346 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,8 @@ development ----------- - fix issue59: add option "--skip-missing-interpreters" which won't fail the - build if Python interpreters listed in tox.ini are missing. + build if Python interpreters listed in tox.ini are missing. Thanks + Alexandre Conrad for the PR. 1.7.1 --------- -- cgit v1.2.1 From be42875b9259dd0fa652536ff6e0e3874f509c52 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 10 May 2014 09:22:07 +0200 Subject: fix issue164: better traceback info in case of failing test commands. Thanks Marc Abramowitz for the PR. --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 8afc346..55f6689 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,10 @@ development 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 --------- -- cgit v1.2.1 From ecc8d45e048234e7d57b9b7cc14d09d8181d573b Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 10 May 2014 11:43:40 +0200 Subject: remove executable bit --- CHANGELOG | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 CHANGELOG diff --git a/CHANGELOG b/CHANGELOG old mode 100755 new mode 100644 -- cgit v1.2.1