4 new commits in tox: https://bitbucket.org/hpk42/tox/commits/dcecf02917cf/ Changeset: dcecf02917cf User: Mark Hirota Date: 2015-02-10 00:30:00+00:00 Summary: Fix issue #124 Affected #: 4 files
diff -r 27b8bdcddd6a197ad600afac03a1e3fb61cc6a5b -r dcecf02917cfdfc681b00f2c8eeb2193ad283617 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,9 @@ - echo output to stdout when ``--report-json`` is used +- fix issue124: ignore command exit codes; when a command has a "-" prefix, + tox will ignore the exit code of that command + 1.8.1 ----------- diff -r 27b8bdcddd6a197ad600afac03a1e3fb61cc6a5b -r dcecf02917cfdfc681b00f2c8eeb2193ad283617 CONTRIBUTORS --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -29,3 +29,4 @@ Marc Schlaich Clark Boylan Eugene Yunak +Mark Hirota diff -r 27b8bdcddd6a197ad600afac03a1e3fb61cc6a5b -r dcecf02917cfdfc681b00f2c8eeb2193ad283617 tox/_cmdline.py --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -79,7 +79,7 @@ f.flush() return f - def popen(self, args, cwd=None, env=None, redirect=True, returnout=False): + def popen(self, args, cwd=None, env=None, redirect=True, returnout=False, ignore_ret=False): stdout = outpath = None resultjson = self.session.config.option.resultjson if resultjson or redirect: @@ -141,7 +141,7 @@ ret = popen.wait() finally: self._popenlist.remove(popen) - if ret: + if ret and not ignore_ret: invoked = " ".join(map(str, popen.args)) if outpath: self.report.error("invocation failed (exit code %d), logfile: %s" % diff -r 27b8bdcddd6a197ad600afac03a1e3fb61cc6a5b -r dcecf02917cfdfc681b00f2c8eeb2193ad283617 tox/_venv.py --- a/tox/_venv.py +++ b/tox/_venv.py @@ -345,8 +345,19 @@ message = "commands[%s] | %s" % (i, ' '.join( [str(x) for x in argv])) action.setactivity("runtests", message) + # check to see if we need to ignore the return code + # if so, we need to alter the command line arguments + if argv[0].startswith("-"): + ignore_ret = True + if argv[0] == "-": + del argv[0] + else: + argv[0] = argv[0].lstrip("-") + else: + ignore_ret = False + try: - self._pcall(argv, cwd=cwd, action=action, redirect=redirect) + self._pcall(argv, cwd=cwd, action=action, redirect=redirect, ignore_ret=ignore_ret) except tox.exception.InvocationError: val = sys.exc_info()[1] self.session.report.error(str(val)) @@ -357,7 +368,7 @@ raise def _pcall(self, args, venv=True, cwd=None, extraenv={}, - action=None, redirect=True): + action=None, redirect=True, ignore_ret=False): for name in ("VIRTUALENV_PYTHON", "PYTHONDONTWRITEBYTECODE"): try: del os.environ[name] @@ -369,7 +380,7 @@ try: args[0] = self.getcommandpath(args[0], venv, cwd) env = self._getenv(extraenv) - return action.popen(args, cwd=cwd, env=env, redirect=redirect) + return action.popen(args, cwd=cwd, env=env, redirect=redirect, ignore_ret=ignore_ret) finally: os.environ['PATH'] = old https://bitbucket.org/hpk42/tox/commits/e63209744ef1/ Changeset: e63209744ef1 User: Mark Hirota Date: 2015-02-11 19:11:54+00:00 Summary: Update doc files for issue #124 fix Affected #: 2 files diff -r dcecf02917cfdfc681b00f2c8eeb2193ad283617 -r e63209744ef18938575a274cd6527ea687106305 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -86,6 +86,8 @@ will be appended (and may contain another ``\`` character ...). For eventually performing a call to ``subprocess.Popen(args, ...)`` ``args`` are determined by splitting the whole command by whitespace. + Similar to ``make`` recipe lines, any command with a leading ``-`` + will ignore the exit code. .. confval:: install_command=ARGV diff -r dcecf02917cfdfc681b00f2c8eeb2193ad283617 -r e63209744ef18938575a274cd6527ea687106305 doc/example/basic.txt --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -244,3 +244,19 @@ python setup.py test -a "-epy27" is equivalent to running ``tox -epy27``. + +Ignoring a command exit code +---------------------------- + +In some cases, you may want to ignore a command exit code. For example:: + + [testenv:py27] + commands = coverage erase + {envbindir}/python setup.py develop + coverage run -p setup.py test + coverage combine + - coverage html + {envbindir}/flake8 loads + +By using the ``-`` prefix, similar to a ``make`` recipe line, you can ignore +the exit code for that command. https://bitbucket.org/hpk42/tox/commits/81c1e121afbf/ Changeset: 81c1e121afbf User: Mark Hirota Date: 2015-02-11 19:35:56+00:00 Summary: Merged hpk42/tox into default; Resolved conflict in CHANGELOG Affected #: 5 files diff -r e63209744ef18938575a274cd6527ea687106305 -r 81c1e121afbf2ee910d110e16c26ac892fdce16c CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,9 @@ - echo output to stdout when ``--report-json`` is used +- fix issue11: add a ``skip_install`` per-testenv setting which + prevents the installation of a package. Thanks Julian Krause. + - fix issue124: ignore command exit codes; when a command has a "-" prefix, tox will ignore the exit code of that command diff -r e63209744ef18938575a274cd6527ea687106305 -r 81c1e121afbf2ee910d110e16c26ac892fdce16c CONTRIBUTORS --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -24,6 +24,7 @@ Mattieu Agopian Asmund Grammeltwedt Ionel Maries Cristian +Julian Krause Alexandre Conrad Morgan Fainberg Marc Schlaich diff -r e63209744ef18938575a274cd6527ea687106305 -r 81c1e121afbf2ee910d110e16c26ac892fdce16c doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -254,6 +254,16 @@ **default**: ``False`` +.. confval:: skip_install=BOOL + + .. versionadded:: 1.9 + + Do not install the current package. This can be used when you need the + virtualenv management but do not want to install the current package + into that environment. + + **default**: ``False`` + Substitutions ------------- diff -r e63209744ef18938575a274cd6527ea687106305 -r 81c1e121afbf2ee910d110e16c26ac892fdce16c tox/_cmdline.py --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -474,7 +474,7 @@ if self.setupenv(venv): if venv.envconfig.develop: self.developpkg(venv, self.config.setupdir) - elif self.config.skipsdist: + elif self.config.skipsdist or venv.envconfig.skip_install: self.finishvenv(venv) else: self.installpkg(venv, sdist_path) diff -r e63209744ef18938575a274cd6527ea687106305 -r 81c1e121afbf2ee910d110e16c26ac892fdce16c tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -395,6 +395,8 @@ vc.pip_pre = config.option.pre or reader.getbool( section, "pip_pre", False) + vc.skip_install = reader.getbool(section, "skip_install", False) + return vc def _getenvdata(self, reader, toxsection): https://bitbucket.org/hpk42/tox/commits/4298877e4216/ Changeset: 4298877e4216 User: hpk42 Date: 2015-02-21 19:18:16+00:00 Summary: Merged in mhirota/tox (pull request #133) Fix issue #124 Affected #: 6 files diff -r 87d02c331675117c9104739fcff2ff0e8d10c3e6 -r 4298877e42165fcc80bccd1cc809583f8178c301 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,9 @@ - fix issue11: add a ``skip_install`` per-testenv setting which prevents the installation of a package. Thanks Julian Krause. +- fix issue124: ignore command exit codes; when a command has a "-" prefix, + tox will ignore the exit code of that command + 1.8.1 ----------- diff -r 87d02c331675117c9104739fcff2ff0e8d10c3e6 -r 4298877e42165fcc80bccd1cc809583f8178c301 CONTRIBUTORS --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -30,3 +30,4 @@ Marc Schlaich Clark Boylan Eugene Yunak +Mark Hirota diff -r 87d02c331675117c9104739fcff2ff0e8d10c3e6 -r 4298877e42165fcc80bccd1cc809583f8178c301 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -86,6 +86,8 @@ will be appended (and may contain another ``\`` character ...). For eventually performing a call to ``subprocess.Popen(args, ...)`` ``args`` are determined by splitting the whole command by whitespace. + Similar to ``make`` recipe lines, any command with a leading ``-`` + will ignore the exit code. .. confval:: install_command=ARGV diff -r 87d02c331675117c9104739fcff2ff0e8d10c3e6 -r 4298877e42165fcc80bccd1cc809583f8178c301 doc/example/basic.txt --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -244,3 +244,19 @@ python setup.py test -a "-epy27" is equivalent to running ``tox -epy27``. + +Ignoring a command exit code +---------------------------- + +In some cases, you may want to ignore a command exit code. For example:: + + [testenv:py27] + commands = coverage erase + {envbindir}/python setup.py develop + coverage run -p setup.py test + coverage combine + - coverage html + {envbindir}/flake8 loads + +By using the ``-`` prefix, similar to a ``make`` recipe line, you can ignore +the exit code for that command. diff -r 87d02c331675117c9104739fcff2ff0e8d10c3e6 -r 4298877e42165fcc80bccd1cc809583f8178c301 tox/_cmdline.py --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -79,7 +79,7 @@ f.flush() return f - def popen(self, args, cwd=None, env=None, redirect=True, returnout=False): + def popen(self, args, cwd=None, env=None, redirect=True, returnout=False, ignore_ret=False): stdout = outpath = None resultjson = self.session.config.option.resultjson if resultjson or redirect: @@ -141,7 +141,7 @@ ret = popen.wait() finally: self._popenlist.remove(popen) - if ret: + if ret and not ignore_ret: invoked = " ".join(map(str, popen.args)) if outpath: self.report.error("invocation failed (exit code %d), logfile: %s" % diff -r 87d02c331675117c9104739fcff2ff0e8d10c3e6 -r 4298877e42165fcc80bccd1cc809583f8178c301 tox/_venv.py --- a/tox/_venv.py +++ b/tox/_venv.py @@ -345,8 +345,19 @@ message = "commands[%s] | %s" % (i, ' '.join( [str(x) for x in argv])) action.setactivity("runtests", message) + # check to see if we need to ignore the return code + # if so, we need to alter the command line arguments + if argv[0].startswith("-"): + ignore_ret = True + if argv[0] == "-": + del argv[0] + else: + argv[0] = argv[0].lstrip("-") + else: + ignore_ret = False + try: - self._pcall(argv, cwd=cwd, action=action, redirect=redirect) + self._pcall(argv, cwd=cwd, action=action, redirect=redirect, ignore_ret=ignore_ret) except tox.exception.InvocationError: val = sys.exc_info()[1] self.session.report.error(str(val)) @@ -357,7 +368,7 @@ raise def _pcall(self, args, venv=True, cwd=None, extraenv={}, - action=None, redirect=True): + action=None, redirect=True, ignore_ret=False): for name in ("VIRTUALENV_PYTHON", "PYTHONDONTWRITEBYTECODE"): try: del os.environ[name] @@ -369,7 +380,7 @@ try: args[0] = self.getcommandpath(args[0], venv, cwd) env = self._getenv(extraenv) - return action.popen(args, cwd=cwd, env=env, redirect=redirect) + return action.popen(args, cwd=cwd, env=env, redirect=redirect, ignore_ret=ignore_ret) finally: os.environ['PATH'] = old 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