1 new commit in tox:
https://bitbucket.org/hpk42/tox/commits/3d7925f2ef6c/
Changeset: 3d7925f2ef6c
User: hpk42
Date: 2015-05-11 10:08:59+00:00
Summary: Merged in msabramo/tox/abort_by_default_when_a_command_fails (pull
request #151)
Abort command execution when a command fails by default
Affected #: 6 files
diff -r 850fb37c60625112b2bf5ad21373d2804be98336 -r
3d7925f2ef6c716de3bc3e84f649ce9b5f15b498 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -17,6 +17,12 @@
If platform is set and doesn't match the platform spec in the test
environment the test environment is ignored, no setup or tests are attempted.
+.. (new) add per-venv "ignore_errors" setting, which defaults to False.
+ If ``True``, a non-zero exit code from one command will be ignored and
+ further commands will be executed (which was the default behavior in tox <
+ 2.0). If ``False`` (the default), then a non-zero exit code from one
command
+ will abort execution of commands for that environment.
+
- remove the long-deprecated "distribute" option as it has no effect these
days.
- fix issue233: avoid hanging with tox-setuptools integration example. Thanks
simonb.
diff -r 850fb37c60625112b2bf5ad21373d2804be98336 -r
3d7925f2ef6c716de3bc3e84f649ce9b5f15b498 doc/config.txt
--- a/doc/config.txt
+++ b/doc/config.txt
@@ -110,6 +110,26 @@
pip install {opts} {packages}
+.. confval:: ignore_errors=True|False(default)
+
+ .. versionadded:: 2.0
+
+ If ``True``, a non-zero exit code from one command will be ignored and
+ further commands will be executed (which was the default behavior in tox
<
+ 2.0). If ``False`` (the default), then a non-zero exit code from one
command
+ will abort execution of commands for that environment.
+
+ It may be helpful to note that this setting is analogous to the ``-i`` or
+ ``ignore-errors`` option of GNU Make. A similar name was chosen to
reflect the
+ similarity in function.
+
+ Note that in tox 2.0, the default behavior of tox with respect to
+ treating errors from commands changed. Tox < 2.0 would ignore errors by
+ default. Tox >= 2.0 will abort on an error by default, which is safer
and more
+ typical of CI and command execution tools, as it doesn't make sense to
+ run tests if installing some prerequisite failed and it doesn't make
sense to
+ try to deploy if tests failed.
+
.. confval:: pip_pre=True|False(default)
.. versionadded:: 1.9
diff -r 850fb37c60625112b2bf5ad21373d2804be98336 -r
3d7925f2ef6c716de3bc3e84f649ce9b5f15b498 tests/test_config.py
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -587,6 +587,7 @@
assert envconfig.changedir == config.setupdir
assert envconfig.sitepackages is False
assert envconfig.develop is False
+ assert envconfig.ignore_errors is False
assert envconfig.envlogdir == envconfig.envdir.join("log")
assert list(envconfig.setenv.keys()) == ['PYTHONHASHSEED']
hashseed = envconfig.setenv['PYTHONHASHSEED']
@@ -647,6 +648,15 @@
assert envconfig.changedir.basename == "xyz"
assert envconfig.changedir == config.toxinidir.join("xyz")
+ def test_ignore_errors(self, tmpdir, newconfig):
+ config = newconfig("""
+ [testenv]
+ ignore_errors=True
+ """)
+ assert len(config.envconfigs) == 1
+ envconfig = config.envconfigs['python']
+ assert envconfig.ignore_errors is True
+
def test_envbindir(self, tmpdir, newconfig):
config = newconfig("""
[testenv]
diff -r 850fb37c60625112b2bf5ad21373d2804be98336 -r
3d7925f2ef6c716de3bc3e84f649ce9b5f15b498 tox/_cmdline.py
--- a/tox/_cmdline.py
+++ b/tox/_cmdline.py
@@ -157,7 +157,7 @@
raise tox.exception.InvocationError(
"%s (see %s)" % (invoked, outpath), ret)
else:
- raise tox.exception.InvocationError("%r" % (invoked, ))
+ raise tox.exception.InvocationError("%r" % (invoked, ), ret)
if not out and outpath:
out = outpath.read()
if hasattr(self, "commandlog"):
diff -r 850fb37c60625112b2bf5ad21373d2804be98336 -r
3d7925f2ef6c716de3bc3e84f649ce9b5f15b498 tox/_config.py
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -442,6 +442,7 @@
section, "pip_pre", False)
vc.skip_install = reader.getbool(section, "skip_install", False)
+ vc.ignore_errors = reader.getbool(section, "ignore_errors", False)
return vc
diff -r 850fb37c60625112b2bf5ad21373d2804be98336 -r
3d7925f2ef6c716de3bc3e84f649ce9b5f15b498 tox/_venv.py
--- a/tox/_venv.py
+++ b/tox/_venv.py
@@ -361,6 +361,14 @@
val = sys.exc_info()[1]
self.session.report.error(str(val))
self.status = "commands failed"
+ if not self.envconfig.ignore_errors:
+ self.session.report.error(
+ 'Stopping processing of commands for env %s '
+ 'because `%s` failed with exit code %s'
+ % (self.name,
+ ' '.join([str(x) for x in argv]),
+ val.args[1]))
+ break # Don't process remaining commands
except KeyboardInterrupt:
self.status = "keyboardinterrupt"
self.session.report.error(self.status)
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
[email protected]
https://mail.python.org/mailman/listinfo/pytest-commit