8 new commits in tox: https://bitbucket.org/hpk42/tox/commits/5e480527c288/ Changeset: 5e480527c288 Branch: 174-voting-testenv User: Rebecka Gulliksson Date: 2015-08-24 08:27:21+00:00 Summary: Added 'voting' testenv attribute. Affected #: 2 files
diff -r 3ed5dc353a99acf57859a2dd265b5c2e973480e3 -r 5e480527c288cd6b69533c20bb7b512fd2022ffe tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -32,7 +32,7 @@ deps= world1 :xyz:http://hello/world - """ % (tmpdir, )) + """ % (tmpdir,)) assert config.toxworkdir == tmpdir assert len(config.envconfigs) == 2 assert config.envconfigs['py1'].envdir == tmpdir.join("py1") @@ -92,12 +92,18 @@ """ Ensure correct parseini._is_same_dep is working with a few samples. """ - assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3') - assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3>=2.0') - assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3>2.0') - assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3<2.0') - assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3<=2.0') - assert not DepOption._is_same_dep('pkg_hello-world3==1.0', 'otherpkg>=2.0') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', + 'pkg_hello-world3') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', + 'pkg_hello-world3>=2.0') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', + 'pkg_hello-world3>2.0') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', + 'pkg_hello-world3<2.0') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', + 'pkg_hello-world3<=2.0') + assert not DepOption._is_same_dep('pkg_hello-world3==1.0', + 'otherpkg>=2.0') class TestConfigPlatform: @@ -109,7 +115,8 @@ assert len(config.envconfigs) == 1 assert config.envconfigs['py1'].platform == "linux2" - def test_config_parse_platform_rex(self, newconfig, mocksession, monkeypatch): + def test_config_parse_platform_rex(self, newconfig, mocksession, + monkeypatch): config = newconfig([], """ [testenv:py1] platform = a123|b123 @@ -126,7 +133,8 @@ assert not venv.matching_platform() @pytest.mark.parametrize("plat", ["win", "lin", ]) - def test_config_parse_platform_with_factors(self, newconfig, plat, monkeypatch): + def test_config_parse_platform_with_factors(self, newconfig, plat, + monkeypatch): monkeypatch.setattr(sys, "platform", "win32") config = newconfig([], """ [tox] @@ -273,7 +281,8 @@ [mydefault] key2={xyz} """) - reader = SectionReader("mydefault", config._cfg, fallbacksections=['mydefault']) + reader = SectionReader("mydefault", config._cfg, + fallbacksections=['mydefault']) assert reader is not None with py.test.raises(tox.exception.ConfigError): reader.getstring("key2") @@ -285,7 +294,8 @@ [section] key=value """) - reader = SectionReader("section", config._cfg, fallbacksections=['mydefault']) + reader = SectionReader("section", config._cfg, + fallbacksections=['mydefault']) x = reader.getstring("key2") assert x == "value2" x = reader.getstring("key3") @@ -300,7 +310,8 @@ [section] key={value} """) - reader = SectionReader("section", config._cfg, fallbacksections=['mydefault']) + reader = SectionReader("section", config._cfg, + fallbacksections=['mydefault']) reader.addsubstitutions(value="newvalue", value2="newvalue2") x = reader.getstring("key2") assert x == "newvalue2" @@ -352,7 +363,8 @@ with py.test.raises(tox.exception.ConfigError): reader.getstring("key2") - def test_getstring_environment_substitution_with_default(self, monkeypatch, newconfig): + def test_getstring_environment_substitution_with_default(self, monkeypatch, + newconfig): monkeypatch.setenv("KEY1", "hello") config = newconfig(""" [section] @@ -494,7 +506,9 @@ x = reader.getargvlist("key2") assert x == [["cmd1", "-f", "foo", "bar baz"]] - def test_positional_arguments_are_only_replaced_when_standing_alone(self, tmpdir, newconfig): + def test_positional_arguments_are_only_replaced_when_standing_alone(self, + tmpdir, + newconfig): config = newconfig(""" [section] key= @@ -521,10 +535,12 @@ config = newconfig(inisource) reader = SectionReader("section", config._cfg) posargs = ['hello', 'world'] - reader.addsubstitutions(posargs, envlogdir='ENV_LOG_DIR', envname='ENV_NAME') + reader.addsubstitutions(posargs, envlogdir='ENV_LOG_DIR', + envname='ENV_NAME') expected = [ - 'py.test', '-n5', '--junitxml=ENV_LOG_DIR/junit-ENV_NAME.xml', 'hello', 'world' + 'py.test', '-n5', '--junitxml=ENV_LOG_DIR/junit-ENV_NAME.xml', + 'hello', 'world' ] assert reader.getargvlist('key')[0] == expected @@ -598,6 +614,7 @@ int_hashseed = int(hashseed) # hashseed is random by default, so we can't assert a specific value. assert int_hashseed > 0 + assert envconfig.voting is True def test_sitepackages_switch(self, tmpdir, newconfig): config = newconfig(["--sitepackages"], "") @@ -696,7 +713,8 @@ assert envconfig.setenv['ANOTHER_VAL'] == 'else' @pytest.mark.parametrize("plat", ["win32", "linux2"]) - def test_passenv_as_multiline_list(self, tmpdir, newconfig, monkeypatch, plat): + def test_passenv_as_multiline_list(self, tmpdir, newconfig, monkeypatch, + plat): monkeypatch.setattr(sys, "platform", plat) monkeypatch.setenv("A123A", "a") monkeypatch.setenv("A123B", "b") @@ -726,7 +744,8 @@ assert "A123B" in envconfig.passenv @pytest.mark.parametrize("plat", ["win32", "linux2"]) - def test_passenv_as_space_separated_list(self, tmpdir, newconfig, monkeypatch, plat): + def test_passenv_as_space_separated_list(self, tmpdir, newconfig, + monkeypatch, plat): monkeypatch.setattr(sys, "platform", plat) monkeypatch.setenv("A123A", "a") monkeypatch.setenv("A123B", "b") @@ -1112,7 +1131,7 @@ conf = newconfig([], inisource) configs = conf.envconfigs assert [dep.name for dep in configs['a-x'].deps] == \ - ["dep-all", "dep-a", "dep-x"] + ["dep-all", "dep-a", "dep-x"] assert [dep.name for dep in configs['b'].deps] == ["dep-all", "dep-b"] def test_factor_ops(self, newconfig): @@ -1213,7 +1232,15 @@ configs = newconfig([], inisource).envconfigs assert sorted(configs) == ["py27-django1.6", "py27-django1.7"] assert [d.name for d in configs["py27-django1.6"].deps] \ - == ["Django==1.6"] + == ["Django==1.6"] + + def test_voting(self, newconfig): + inisource = """ + [testenv] + voting=False + """ + config = newconfig([], inisource).envconfigs + assert config["python"].voting is False class TestGlobalOptions: @@ -1334,7 +1361,7 @@ """ config = newconfig([], inisource) assert config.envlist == \ - ["py26-dep1", "py26-dep2", "py27-dep1", "py27-dep2"] + ["py26-dep1", "py26-dep2", "py27-dep1", "py27-dep2"] def test_envlist_multiline(self, newconfig): inisource = """ @@ -1345,7 +1372,7 @@ """ config = newconfig([], inisource) assert config.envlist == \ - ["py27", "py34"] + ["py27", "py34"] def test_minversion(self, tmpdir, newconfig, monkeypatch): inisource = """ @@ -1355,7 +1382,8 @@ config = newconfig([], inisource) assert config.minversion == "3.0" - def test_skip_missing_interpreters_true(self, tmpdir, newconfig, monkeypatch): + def test_skip_missing_interpreters_true(self, tmpdir, newconfig, + monkeypatch): inisource = """ [tox] skip_missing_interpreters = True @@ -1363,7 +1391,8 @@ config = newconfig([], inisource) assert config.option.skip_missing_interpreters - def test_skip_missing_interpreters_false(self, tmpdir, newconfig, monkeypatch): + def test_skip_missing_interpreters_false(self, tmpdir, newconfig, + monkeypatch): inisource = """ [tox] skip_missing_interpreters = False @@ -1391,7 +1420,6 @@ class TestHashseedOption: - def _get_envconfigs(self, newconfig, args=None, tox_ini=None, make_hashseed=None): if args is None: @@ -1488,6 +1516,7 @@ def make_hashseed(): next_seed[0] += 1 return str(next_seed[0]) + # Check that make_hashseed() works. assert make_hashseed() == '1001' envconfigs = self._get_envconfigs(newconfig, tox_ini=tox_ini, @@ -1555,11 +1584,11 @@ config = newconfig([], inisource) expected = "file://%s/.pip/downloads/simple" % config.homedir assert config.indexserver['default'].url == expected - assert config.indexserver['local1'].url == config.indexserver['default'].url + assert config.indexserver['local1'].url == config.indexserver[ + 'default'].url class TestParseEnv: - def test_parse_recreate(self, newconfig): inisource = "" config = newconfig([], inisource) @@ -1667,7 +1696,6 @@ class TestCommandParser: - def test_command_parser_for_word(self): p = CommandParser('word') # import pytest; pytest.set_trace() @@ -1692,8 +1720,10 @@ p = CommandParser(complex_case) parsed = list(p.words()) expected = [ - 'word', ' ', '[]', ' ', '[literal]', ' ', '{something}', ' ', '{some:other thing}', - ' ', 'w', '{ord}', ' ', 'w', '{or}', 'd', ' ', 'w', '{ord}', ' ', 'w', '{o:rd}', ' ', + 'word', ' ', '[]', ' ', '[literal]', ' ', '{something}', ' ', + '{some:other thing}', + ' ', 'w', '{ord}', ' ', 'w', '{or}', 'd', ' ', 'w', '{ord}', ' ', + 'w', '{o:rd}', ' ', 'w', '{o:r}', 'd', ' ', '{w:or}', 'd', ' ', 'w[]ord', ' ', '{posargs:{a key}}', ] @@ -1711,7 +1741,8 @@ other}""") p = CommandParser(cmd) parsed = list(p.words()) - assert parsed == ['cmd2', ' ', '{posargs:{item2}\n other}'] + assert parsed == ['cmd2', ' ', + '{posargs:{item2}\n other}'] def test_command_parsing_for_issue_10(self): cmd = "nosetests -v -a !deferred --with-doctest []" diff -r 3ed5dc353a99acf57859a2dd265b5c2e973480e3 -r 5e480527c288cd6b69533c20bb7b512fd2022ffe tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -473,6 +473,11 @@ name="commands", type="argvlist", default="", help="each line specifies a test command and can use substitution.") + parser.add_testenv_attribute( + "voting", type="bool", default=True, + help="if set to False a failing result of this testenv will not make " + "tox fail") + class Config(object): """ Global Tox config object. """ https://bitbucket.org/hpk42/tox/commits/5a3be83f823d/ Changeset: 5a3be83f823d Branch: 174-voting-testenv User: Rebecka Gulliksson Date: 2015-08-24 09:23:25+00:00 Summary: Respect the 'voting' attribute of a testenv. If the testenv is 'non-voting' keep processing all commands even if one of them fail and don't let it influence the return code of tox. Affected #: 1 file diff -r 5e480527c288cd6b69533c20bb7b512fd2022ffe -r 5a3be83f823dd16e0f08cccfabe8119e35383cc9 tox/venv.py --- a/tox/venv.py +++ b/tox/venv.py @@ -351,6 +351,14 @@ self._pcall(argv, cwd=cwd, action=action, redirect=redirect, ignore_ret=ignore_ret, testcommand=True) except tox.exception.InvocationError as err: + if not self.envconfig.voting: + self.session.report.warning( + "command failed, but testenv is marked " + "non-voting.\n" + " cmd: %s" % (str(err),)) + self.status = "non-voting fail" + continue # keep processing commands + self.session.report.error(str(err)) self.status = "commands failed" if not self.envconfig.ignore_errors: https://bitbucket.org/hpk42/tox/commits/934f500c04a1/ Changeset: 934f500c04a1 Branch: 174-voting-testenv User: Rebecka Gulliksson Date: 2015-08-24 09:24:34+00:00 Summary: Handle the 'non-voting fail' status that can occur in a non-voting testenv. Affected #: 1 file diff -r 5a3be83f823dd16e0f08cccfabe8119e35383cc9 -r 934f500c04a1dae50772f5e168f4ac44724b4ee4 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 == "non-voting fail": + 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) https://bitbucket.org/hpk42/tox/commits/a5cd51a629dd/ Changeset: a5cd51a629dd Branch: 174-voting-testenv User: Rebecka Gulliksson Date: 2015-08-24 10:10:11+00:00 Summary: Added test for non-voting testenv with failing command. Affected #: 1 file diff -r 934f500c04a1dae50772f5e168f4ac44724b4ee4 -r a5cd51a629dde49d6cab564b67385a23c37e18b7 tests/test_venv.py --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -611,3 +611,16 @@ x4 = venv.getcommandpath("x", cwd=tmpdir) assert x4.endswith(os.sep + 'x') mocksession.report.expect("warning", "*test command found but not*") + + +def test_non_voting_failing_cmd(newmocksession): + mocksession = newmocksession([], """ + [testenv] + commands=testenv_fail + voting=False + """) + + venv = mocksession.getenv('python') + venv.test() + assert venv.status == "non-voting fail" + mocksession.report.expect("warning", "*command failed, but testenv*") \ No newline at end of file https://bitbucket.org/hpk42/tox/commits/7b51c70dee73/ Changeset: 7b51c70dee73 Branch: 174-voting-testenv User: Rebecka Gulliksson Date: 2015-08-24 10:21:51+00:00 Summary: Reverted unnecessary code formatting changes. Affected #: 1 file diff -r a5cd51a629dde49d6cab564b67385a23c37e18b7 -r 7b51c70dee7383014228201340d1e4578043d5c5 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -32,7 +32,7 @@ deps= world1 :xyz:http://hello/world - """ % (tmpdir,)) + """ % (tmpdir, )) assert config.toxworkdir == tmpdir assert len(config.envconfigs) == 2 assert config.envconfigs['py1'].envdir == tmpdir.join("py1") @@ -92,18 +92,12 @@ """ Ensure correct parseini._is_same_dep is working with a few samples. """ - assert DepOption._is_same_dep('pkg_hello-world3==1.0', - 'pkg_hello-world3') - assert DepOption._is_same_dep('pkg_hello-world3==1.0', - 'pkg_hello-world3>=2.0') - assert DepOption._is_same_dep('pkg_hello-world3==1.0', - 'pkg_hello-world3>2.0') - assert DepOption._is_same_dep('pkg_hello-world3==1.0', - 'pkg_hello-world3<2.0') - assert DepOption._is_same_dep('pkg_hello-world3==1.0', - 'pkg_hello-world3<=2.0') - assert not DepOption._is_same_dep('pkg_hello-world3==1.0', - 'otherpkg>=2.0') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3>=2.0') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3>2.0') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3<2.0') + assert DepOption._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3<=2.0') + assert not DepOption._is_same_dep('pkg_hello-world3==1.0', 'otherpkg>=2.0') class TestConfigPlatform: @@ -115,8 +109,7 @@ assert len(config.envconfigs) == 1 assert config.envconfigs['py1'].platform == "linux2" - def test_config_parse_platform_rex(self, newconfig, mocksession, - monkeypatch): + def test_config_parse_platform_rex(self, newconfig, mocksession, monkeypatch): config = newconfig([], """ [testenv:py1] platform = a123|b123 @@ -133,8 +126,7 @@ assert not venv.matching_platform() @pytest.mark.parametrize("plat", ["win", "lin", ]) - def test_config_parse_platform_with_factors(self, newconfig, plat, - monkeypatch): + def test_config_parse_platform_with_factors(self, newconfig, plat, monkeypatch): monkeypatch.setattr(sys, "platform", "win32") config = newconfig([], """ [tox] @@ -281,8 +273,7 @@ [mydefault] key2={xyz} """) - reader = SectionReader("mydefault", config._cfg, - fallbacksections=['mydefault']) + reader = SectionReader("mydefault", config._cfg, fallbacksections=['mydefault']) assert reader is not None with py.test.raises(tox.exception.ConfigError): reader.getstring("key2") @@ -294,8 +285,7 @@ [section] key=value """) - reader = SectionReader("section", config._cfg, - fallbacksections=['mydefault']) + reader = SectionReader("section", config._cfg, fallbacksections=['mydefault']) x = reader.getstring("key2") assert x == "value2" x = reader.getstring("key3") @@ -310,8 +300,7 @@ [section] key={value} """) - reader = SectionReader("section", config._cfg, - fallbacksections=['mydefault']) + reader = SectionReader("section", config._cfg, fallbacksections=['mydefault']) reader.addsubstitutions(value="newvalue", value2="newvalue2") x = reader.getstring("key2") assert x == "newvalue2" @@ -363,8 +352,7 @@ with py.test.raises(tox.exception.ConfigError): reader.getstring("key2") - def test_getstring_environment_substitution_with_default(self, monkeypatch, - newconfig): + def test_getstring_environment_substitution_with_default(self, monkeypatch, newconfig): monkeypatch.setenv("KEY1", "hello") config = newconfig(""" [section] @@ -506,9 +494,7 @@ x = reader.getargvlist("key2") assert x == [["cmd1", "-f", "foo", "bar baz"]] - def test_positional_arguments_are_only_replaced_when_standing_alone(self, - tmpdir, - newconfig): + def test_positional_arguments_are_only_replaced_when_standing_alone(self, tmpdir, newconfig): config = newconfig(""" [section] key= @@ -535,12 +521,10 @@ config = newconfig(inisource) reader = SectionReader("section", config._cfg) posargs = ['hello', 'world'] - reader.addsubstitutions(posargs, envlogdir='ENV_LOG_DIR', - envname='ENV_NAME') + reader.addsubstitutions(posargs, envlogdir='ENV_LOG_DIR', envname='ENV_NAME') expected = [ - 'py.test', '-n5', '--junitxml=ENV_LOG_DIR/junit-ENV_NAME.xml', - 'hello', 'world' + 'py.test', '-n5', '--junitxml=ENV_LOG_DIR/junit-ENV_NAME.xml', 'hello', 'world' ] assert reader.getargvlist('key')[0] == expected @@ -713,8 +697,7 @@ assert envconfig.setenv['ANOTHER_VAL'] == 'else' @pytest.mark.parametrize("plat", ["win32", "linux2"]) - def test_passenv_as_multiline_list(self, tmpdir, newconfig, monkeypatch, - plat): + def test_passenv_as_multiline_list(self, tmpdir, newconfig, monkeypatch, plat): monkeypatch.setattr(sys, "platform", plat) monkeypatch.setenv("A123A", "a") monkeypatch.setenv("A123B", "b") @@ -744,8 +727,7 @@ assert "A123B" in envconfig.passenv @pytest.mark.parametrize("plat", ["win32", "linux2"]) - def test_passenv_as_space_separated_list(self, tmpdir, newconfig, - monkeypatch, plat): + def test_passenv_as_space_separated_list(self, tmpdir, newconfig, monkeypatch, plat): monkeypatch.setattr(sys, "platform", plat) monkeypatch.setenv("A123A", "a") monkeypatch.setenv("A123B", "b") @@ -1131,7 +1113,7 @@ conf = newconfig([], inisource) configs = conf.envconfigs assert [dep.name for dep in configs['a-x'].deps] == \ - ["dep-all", "dep-a", "dep-x"] + ["dep-all", "dep-a", "dep-x"] assert [dep.name for dep in configs['b'].deps] == ["dep-all", "dep-b"] def test_factor_ops(self, newconfig): @@ -1232,7 +1214,7 @@ configs = newconfig([], inisource).envconfigs assert sorted(configs) == ["py27-django1.6", "py27-django1.7"] assert [d.name for d in configs["py27-django1.6"].deps] \ - == ["Django==1.6"] + == ["Django==1.6"] def test_voting(self, newconfig): inisource = """ @@ -1361,7 +1343,7 @@ """ config = newconfig([], inisource) assert config.envlist == \ - ["py26-dep1", "py26-dep2", "py27-dep1", "py27-dep2"] + ["py26-dep1", "py26-dep2", "py27-dep1", "py27-dep2"] def test_envlist_multiline(self, newconfig): inisource = """ @@ -1372,7 +1354,7 @@ """ config = newconfig([], inisource) assert config.envlist == \ - ["py27", "py34"] + ["py27", "py34"] def test_minversion(self, tmpdir, newconfig, monkeypatch): inisource = """ @@ -1382,8 +1364,7 @@ config = newconfig([], inisource) assert config.minversion == "3.0" - def test_skip_missing_interpreters_true(self, tmpdir, newconfig, - monkeypatch): + def test_skip_missing_interpreters_true(self, tmpdir, newconfig, monkeypatch): inisource = """ [tox] skip_missing_interpreters = True @@ -1391,8 +1372,7 @@ config = newconfig([], inisource) assert config.option.skip_missing_interpreters - def test_skip_missing_interpreters_false(self, tmpdir, newconfig, - monkeypatch): + def test_skip_missing_interpreters_false(self, tmpdir, newconfig, monkeypatch): inisource = """ [tox] skip_missing_interpreters = False @@ -1420,6 +1400,7 @@ class TestHashseedOption: + def _get_envconfigs(self, newconfig, args=None, tox_ini=None, make_hashseed=None): if args is None: @@ -1516,7 +1497,6 @@ def make_hashseed(): next_seed[0] += 1 return str(next_seed[0]) - # Check that make_hashseed() works. assert make_hashseed() == '1001' envconfigs = self._get_envconfigs(newconfig, tox_ini=tox_ini, @@ -1584,11 +1564,11 @@ config = newconfig([], inisource) expected = "file://%s/.pip/downloads/simple" % config.homedir assert config.indexserver['default'].url == expected - assert config.indexserver['local1'].url == config.indexserver[ - 'default'].url + assert config.indexserver['local1'].url == config.indexserver['default'].url class TestParseEnv: + def test_parse_recreate(self, newconfig): inisource = "" config = newconfig([], inisource) @@ -1696,6 +1676,7 @@ class TestCommandParser: + def test_command_parser_for_word(self): p = CommandParser('word') # import pytest; pytest.set_trace() @@ -1720,10 +1701,8 @@ p = CommandParser(complex_case) parsed = list(p.words()) expected = [ - 'word', ' ', '[]', ' ', '[literal]', ' ', '{something}', ' ', - '{some:other thing}', - ' ', 'w', '{ord}', ' ', 'w', '{or}', 'd', ' ', 'w', '{ord}', ' ', - 'w', '{o:rd}', ' ', + 'word', ' ', '[]', ' ', '[literal]', ' ', '{something}', ' ', '{some:other thing}', + ' ', 'w', '{ord}', ' ', 'w', '{or}', 'd', ' ', 'w', '{ord}', ' ', 'w', '{o:rd}', ' ', 'w', '{o:r}', 'd', ' ', '{w:or}', 'd', ' ', 'w[]ord', ' ', '{posargs:{a key}}', ] @@ -1741,8 +1720,7 @@ other}""") p = CommandParser(cmd) parsed = list(p.words()) - assert parsed == ['cmd2', ' ', - '{posargs:{item2}\n other}'] + assert parsed == ['cmd2', ' ', '{posargs:{item2}\n other}'] def test_command_parsing_for_issue_10(self): cmd = "nosetests -v -a !deferred --with-doctest []" https://bitbucket.org/hpk42/tox/commits/7fd09ff4368f/ Changeset: 7fd09ff4368f Branch: 174-voting-testenv User: Rebecka Gulliksson Date: 2015-08-24 10:57:09+00:00 Summary: Renamed testenv attribute from 'voting' to 'ignore_outcome'. Affected #: 4 files diff -r 7b51c70dee7383014228201340d1e4578043d5c5 -r 7fd09ff4368f6c737b1e232c8e45fa71ae845b5c tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -598,7 +598,7 @@ int_hashseed = int(hashseed) # hashseed is random by default, so we can't assert a specific value. assert int_hashseed > 0 - assert envconfig.voting is True + assert envconfig.ignore_outcome is False def test_sitepackages_switch(self, tmpdir, newconfig): config = newconfig(["--sitepackages"], "") @@ -1216,13 +1216,13 @@ assert [d.name for d in configs["py27-django1.6"].deps] \ == ["Django==1.6"] - def test_voting(self, newconfig): + def test_ignore_outcome(self, newconfig): inisource = """ [testenv] - voting=False + ignore_outcome=True """ config = newconfig([], inisource).envconfigs - assert config["python"].voting is False + assert config["python"].ignore_outcome is True class TestGlobalOptions: diff -r 7b51c70dee7383014228201340d1e4578043d5c5 -r 7fd09ff4368f6c737b1e232c8e45fa71ae845b5c 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() @@ -613,14 +614,15 @@ mocksession.report.expect("warning", "*test command found but not*") -def test_non_voting_failing_cmd(newmocksession): +def test_ignore_outcome_failing_cmd(newmocksession): mocksession = newmocksession([], """ [testenv] commands=testenv_fail - voting=False + ignore_outcome=True """) venv = mocksession.getenv('python') venv.test() - assert venv.status == "non-voting fail" - mocksession.report.expect("warning", "*command failed, but testenv*") \ No newline at end of file + assert venv.status == "ignored failed command" + mocksession.report.expect("warning", "*command failed but result from " + "testenv is ignored*") diff -r 7b51c70dee7383014228201340d1e4578043d5c5 -r 7fd09ff4368f6c737b1e232c8e45fa71ae845b5c tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -474,9 +474,9 @@ help="each line specifies a test command and can use substitution.") parser.add_testenv_attribute( - "voting", type="bool", default=True, - help="if set to False a failing result of this testenv will not make " - "tox fail") + "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): diff -r 7b51c70dee7383014228201340d1e4578043d5c5 -r 7fd09ff4368f6c737b1e232c8e45fa71ae845b5c tox/venv.py --- a/tox/venv.py +++ b/tox/venv.py @@ -351,13 +351,12 @@ self._pcall(argv, cwd=cwd, action=action, redirect=redirect, ignore_ret=ignore_ret, testcommand=True) except tox.exception.InvocationError as err: - if not self.envconfig.voting: + if self.envconfig.ignore_outcome: self.session.report.warning( - "command failed, but testenv is marked " - "non-voting.\n" + "command failed but result from testenv is ignored\n" " cmd: %s" % (str(err),)) - self.status = "non-voting fail" - continue # keep processing commands + self.status = "ignored failed command" + continue # keep processing commands self.session.report.error(str(err)) self.status = "commands failed" https://bitbucket.org/hpk42/tox/commits/28bab1e0d038/ Changeset: 28bab1e0d038 Branch: 174-voting-testenv User: Rebecka Gulliksson Date: 2015-09-21 12:13:30+00:00 Summary: Fixed last rename from 'voting' to 'ignore'. Affected #: 1 file diff -r 7fd09ff4368f6c737b1e232c8e45fa71ae845b5c -r 28bab1e0d03847b9805c360a245cd979334b298d tox/session.py --- a/tox/session.py +++ b/tox/session.py @@ -570,7 +570,7 @@ elif status == "platform mismatch": msg = " %s: %s" % (venv.envconfig.envname, str(status)) self.report.skip(msg) - elif status and status == "non-voting fail": + 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": 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