1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/b799af1ea6e8/ Changeset: b799af1ea6e8 User: hpk42 Date: 2015-11-06 16:44:55+00:00 Summary: Merged in rebeckag/tox/174-voting-testenv (pull request #170)
#174 voting testenv Affected #: 5 files diff -r f68c14edc27afbba4969856a40cf46d9664700d4 -r b799af1ea6e81518882de126d75a4707393af32d tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -640,6 +640,7 @@ int_hashseed = int(hashseed) # hashseed is random by default, so we can't assert a specific value. assert int_hashseed > 0 + assert envconfig.ignore_outcome is False def test_sitepackages_switch(self, tmpdir, newconfig): config = newconfig(["--sitepackages"], "") @@ -1269,6 +1270,14 @@ assert [d.name for d in configs["py27-django1.6"].deps] \ == ["Django==1.6"] + def test_ignore_outcome(self, newconfig): + inisource = """ + [testenv] + ignore_outcome=True + """ + config = newconfig([], inisource).envconfigs + assert config["python"].ignore_outcome is True + class TestGlobalOptions: def test_notest(self, newconfig): diff -r f68c14edc27afbba4969856a40cf46d9664700d4 -r b799af1ea6e81518882de126d75a4707393af32d tests/test_venv.py --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -7,6 +7,7 @@ from tox.venv import * # noqa from tox.interpreters import NoInterpreterInfo + # def test_global_virtualenv(capfd): # v = VirtualEnv() # l = v.list() @@ -611,3 +612,17 @@ x4 = venv.getcommandpath("x", cwd=tmpdir) assert x4.endswith(os.sep + 'x') mocksession.report.expect("warning", "*test command found but not*") + + +def test_ignore_outcome_failing_cmd(newmocksession): + mocksession = newmocksession([], """ + [testenv] + commands=testenv_fail + ignore_outcome=True + """) + + venv = mocksession.getenv('python') + venv.test() + assert venv.status == "ignored failed command" + mocksession.report.expect("warning", "*command failed but result from " + "testenv is ignored*") diff -r f68c14edc27afbba4969856a40cf46d9664700d4 -r b799af1ea6e81518882de126d75a4707393af32d tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -476,6 +476,11 @@ name="commands", type="argvlist", default="", help="each line specifies a test command and can use substitution.") + parser.add_testenv_attribute( + "ignore_outcome", type="bool", default=False, + help="if set to True a failing result of this testenv will not make " + "tox fail, only a warning will be produced") + class Config(object): """ Global Tox config object. """ diff -r f68c14edc27afbba4969856a40cf46d9664700d4 -r b799af1ea6e81518882de126d75a4707393af32d tox/session.py --- a/tox/session.py +++ b/tox/session.py @@ -570,6 +570,9 @@ elif status == "platform mismatch": msg = " %s: %s" % (venv.envconfig.envname, str(status)) self.report.skip(msg) + elif status and status == "ignored failed command": + msg = " %s: %s" % (venv.envconfig.envname, str(status)) + self.report.good(msg) elif status and status != "skipped tests": msg = " %s: %s" % (venv.envconfig.envname, str(status)) self.report.error(msg) diff -r f68c14edc27afbba4969856a40cf46d9664700d4 -r b799af1ea6e81518882de126d75a4707393af32d tox/venv.py --- a/tox/venv.py +++ b/tox/venv.py @@ -351,6 +351,13 @@ self._pcall(argv, cwd=cwd, action=action, redirect=redirect, ignore_ret=ignore_ret, testcommand=True) except tox.exception.InvocationError as err: + if self.envconfig.ignore_outcome: + self.session.report.warning( + "command failed but result from testenv is ignored\n" + " cmd: %s" % (str(err),)) + self.status = "ignored failed command" + continue # keep processing commands + self.session.report.error(str(err)) self.status = "commands failed" if not self.envconfig.ignore_errors: 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