From issues-reply at bitbucket.org Sun Nov 1 09:48:43 2015 From: issues-reply at bitbucket.org (qMax) Date: Sun, 01 Nov 2015 14:48:43 -0000 Subject: [Pytest-commit] Issue #282: tox uses ancient pip/setuptools (hpk42/tox) Message-ID: <20151101144843.31347.484@app08.ash-private.bitbucket.org> New issue 282: tox uses ancient pip/setuptools https://bitbucket.org/hpk42/tox/issues/282/tox-uses-ancient-pip-setuptools qMax: when creating env it installs pip-1.5.4, setuptools-2.2 current versions are pip-7.1.2, setuptools-18 I believe the project tox is dead. From commits-noreply at bitbucket.org Mon Nov 2 07:15:39 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 02 Nov 2015 12:15:39 -0000 Subject: [Pytest-commit] commit/tox: 2 new changesets Message-ID: <20151102121539.12913.50678@app03.ash-private.bitbucket.org> 2 new commits in tox: https://bitbucket.org/hpk42/tox/commits/a1d9e0738543/ Changeset: a1d9e0738543 User: hpk42 Date: 2015-10-30 09:27:14+00:00 Summary: add changelog: fix issue99: the {env:...} substitution now properly uses environment settings from the ``setenv`` section. Thanks Itxaka Serrano. Affected #: 3 files diff -r 763eeed49a7c572a9c31940932cfbeaff8d32ab1 -r a1d9e0738543c1deca87d3dea9b99a0f4267abd1 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,9 @@ - fix issue246: fix regression in config parsing by reordering such that {envbindir} can be used again in tox.ini. Thanks Olli Walsh. +- fix issue99: the {env:...} substitution now properly uses environment + settings from the ``setenv`` section. Thanks Itxaka Serrano. + 2.1.1 ---------- diff -r 763eeed49a7c572a9c31940932cfbeaff8d32ab1 -r a1d9e0738543c1deca87d3dea9b99a0f4267abd1 CONTRIBUTORS --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -31,3 +31,4 @@ Clark Boylan Eugene Yunak Mark Hirota +Itxaka Serrano diff -r 763eeed49a7c572a9c31940932cfbeaff8d32ab1 -r a1d9e0738543c1deca87d3dea9b99a0f4267abd1 setup.cfg --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,13 @@ +[build_sphinx] +source-dir = doc/en/ +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/en/build/html + [bdist_wheel] -universal=1 +universal = 1 + +[devpi:upload] +formats = sdist.tgz,bdist_wheel https://bitbucket.org/hpk42/tox/commits/f68c14edc27a/ Changeset: f68c14edc27a User: hpk42 Date: 2015-11-02 11:59:42+00:00 Summary: fix issue281: make --force-deps work when urls are present in a dep config Affected #: 3 files diff -r a1d9e0738543c1deca87d3dea9b99a0f4267abd1 -r f68c14edc27afbba4969856a40cf46d9664700d4 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,9 @@ - fix issue99: the {env:...} substitution now properly uses environment settings from the ``setenv`` section. Thanks Itxaka Serrano. +- fix issue281: make --force-deps work when urls are present in + dependency configs. Thanks Glyph Lefkowitz for reporting. + 2.1.1 ---------- diff -r a1d9e0738543c1deca87d3dea9b99a0f4267abd1 -r f68c14edc27afbba4969856a40cf46d9664700d4 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -88,6 +88,26 @@ 'dep1==1.5', 'dep2==2.1', 'dep3==3.0', 'dep4==4.0', ] + def test_force_dep_with_url(self, initproj): + initproj("example123-0.5", filedefs={ + 'tox.ini': ''' + [tox] + + [testenv] + deps= + dep1==1.0 + https://pypi.python.org/xyz/pkg1.tar.gz + ''' + }) + config = parseconfig( + ['--force-dep=dep1==1.5']) + assert config.option.force_dep == [ + 'dep1==1.5' + ] + assert [str(x) for x in config.envconfigs['python'].deps] == [ + 'dep1==1.5', 'https://pypi.python.org/xyz/pkg1.tar.gz' + ] + def test_is_same_dep(self): """ Ensure correct parseini._is_same_dep is working with a few samples. diff -r a1d9e0738543c1deca87d3dea9b99a0f4267abd1 -r f68c14edc27afbba4969856a40cf46d9664700d4 tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -141,7 +141,11 @@ same package, even if versions differ. """ dep1_name = pkg_resources.Requirement.parse(dep1).project_name - dep2_name = pkg_resources.Requirement.parse(dep2).project_name + try: + dep2_name = pkg_resources.Requirement.parse(dep2).project_name + except pkg_resources.RequirementParseError: + # we couldn't parse a version, probably a URL + return False return dep1_name == dep2_name 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. From issues-reply at bitbucket.org Wed Nov 4 05:37:39 2015 From: issues-reply at bitbucket.org (Marius Gedminas) Date: Wed, 04 Nov 2015 10:37:39 -0000 Subject: [Pytest-commit] Issue #283: detox creates virtualenvs repeatedly and unnecessarily (hpk42/tox) Message-ID: <20151104103739.24010.25210@app08.ash-private.bitbucket.org> New issue 283: detox creates virtualenvs repeatedly and unnecessarily https://bitbucket.org/hpk42/tox/issues/283/detox-creates-virtualenvs-repeatedly-and Marius Gedminas: When `detox` creates or recreates a virtualenv, it leaves it in a state where both `tox` and `detox` think the virtualenv isn't created at all, so the next run of `tox`/`detox` will create it again, wasting time. See https://gist.github.com/mgedmin/915b5e797c42f622225e for steps to reproduce with full output examples. From issues-reply at bitbucket.org Wed Nov 4 05:38:46 2015 From: issues-reply at bitbucket.org (Marius Gedminas) Date: Wed, 04 Nov 2015 10:38:46 -0000 Subject: [Pytest-commit] Issue #284: detox --version doesn't print detox version (hpk42/tox) Message-ID: <20151104103846.17490.36550@app14.ash-private.bitbucket.org> New issue 284: detox --version doesn't print detox version https://bitbucket.org/hpk42/tox/issues/284/detox-version-doesnt-print-detox-version Marius Gedminas: ``` $ detox --version 2.1.1 imported from /home/mg/.venv/local/lib/python2.7/site-packages/tox/__init__.pyc $ tox --version 2.1.1 imported from /home/mg/.venv/local/lib/python2.7/site-packages/tox/__init__.pyc $ pip list | grep tox detox (0.10.0) tox (2.1.1) ``` It's nice that `detox --version` prints the version of tox, but it should also print its own version. From commits-noreply at bitbucket.org Fri Nov 6 11:44:58 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 06 Nov 2015 16:44:58 -0000 Subject: [Pytest-commit] commit/tox: hpk42: Merged in rebeckag/tox/174-voting-testenv (pull request #170) Message-ID: <20151106164458.37145.8961@celery-worker-101.ash1.bb-inf.net> 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. From commits-noreply at bitbucket.org Fri Nov 6 11:44:58 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 06 Nov 2015 16:44:58 -0000 Subject: [Pytest-commit] commit/tox: 8 new changesets Message-ID: <20151106164458.74647.20547@celery-worker-102.ash1.bb-inf.net> 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. From commits-noreply at bitbucket.org Fri Nov 6 11:46:01 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 06 Nov 2015 16:46:01 -0000 Subject: [Pytest-commit] commit/tox: hpk42: fix issue174: add new ``ignore_outcome`` testenv attribute which Message-ID: <20151106164601.39030.68667@celery-worker-101.ash1.bb-inf.net> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/618ba985f958/ Changeset: 618ba985f958 User: hpk42 Date: 2015-11-06 16:45:52+00:00 Summary: fix issue174: add new ``ignore_outcome`` testenv attribute which can be set to True in which case it will produce a warning instead of an error on a failed testenv command outcome. Thanks Rebecka Gulliksson for the PR. Affected #: 1 file diff -r b799af1ea6e81518882de126d75a4707393af32d -r 618ba985f95889a793c2c367f92f4954f0cdd159 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,11 @@ - fix issue281: make --force-deps work when urls are present in dependency configs. Thanks Glyph Lefkowitz for reporting. +- fix issue174: add new ``ignore_outcome`` testenv attribute which + can be set to True in which case it will produce a warning instead + of an error on a failed testenv command outcome. + Thanks Rebecka Gulliksson for the PR. + 2.1.1 ---------- 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. From commits-noreply at bitbucket.org Mon Nov 9 05:28:29 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 09 Nov 2015 10:28:29 -0000 Subject: [Pytest-commit] commit/tox: hpk42: fix issue280: fix case where --skip-missing-interpreter would not work if {envsitepackagesdir} substitution was used. Message-ID: <20151109102829.47231.40740@celery-worker-102.ash1.bb-inf.net> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/bfb25dfb2e53/ Changeset: bfb25dfb2e53 User: hpk42 Date: 2015-11-09 10:26:26+00:00 Summary: fix issue280: fix case where --skip-missing-interpreter would not work if {envsitepackagesdir} substitution was used. Affected #: 3 files diff -r 618ba985f95889a793c2c367f92f4954f0cdd159 -r bfb25dfb2e53f56d4d85cbd68b7af3c78538c88c CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -19,6 +19,9 @@ of an error on a failed testenv command outcome. Thanks Rebecka Gulliksson for the PR. +- fix issue280: properly skip missing interpreter if + {envsitepackagesdir} is present in commands. Thanks BB:ceridwenv + 2.1.1 ---------- diff -r 618ba985f95889a793c2c367f92f4954f0cdd159 -r bfb25dfb2e53f56d4d85cbd68b7af3c78538c88c tests/test_z_cmdline.py --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -692,8 +692,7 @@ assert sdist_path == p - at pytest.mark.xfail("sys.platform == 'win32' and sys.version_info < (2,6)", - reason="test needs better impl") + at pytest.mark.xfail("sys.platform == 'win32'", reason="test needs better impl") def test_envsitepackagesdir(cmd, initproj): initproj("pkg512-0.0.5", filedefs={ 'tox.ini': """ @@ -708,6 +707,22 @@ """) + at pytest.mark.xfail("sys.platform == 'win32'", reason="test needs better impl") +def test_envsitepackagesdir_skip_missing_issue280(cmd, initproj): + initproj("pkg513-0.0.5", filedefs={ + 'tox.ini': """ + [testenv] + basepython=/usr/bin/qwelkjqwle + commands= + {envsitepackagesdir} + """}) + result = cmd.run("tox", "--skip-missing-interpreters") + assert result.ret == 0 + result.stdout.fnmatch_lines(""" + SKIPPED:*qwelkj* + """) + + def verify_json_report_format(data, testenvs=True): assert data["reportversion"] == "1" assert data["toxversion"] == tox.__version__ diff -r 618ba985f95889a793c2c367f92f4954f0cdd159 -r bfb25dfb2e53f56d4d85cbd68b7af3c78538c88c tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -539,7 +539,6 @@ """ return sitepackagesdir of the virtualenv environment. (only available during execution, not parsing) """ - self.getsupportedinterpreter() # for throwing exceptions x = self.config.interpreters.get_sitepackagesdir( info=self.python_info, envdir=self.envdir) 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. From commits-noreply at bitbucket.org Wed Nov 11 08:48:47 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 11 Nov 2015 13:48:47 -0000 Subject: [Pytest-commit] commit/tox: 4 new changesets Message-ID: <20151111134847.46972.34695@celery-worker-102.ash1.bb-inf.net> 4 new commits in tox: https://bitbucket.org/hpk42/tox/commits/a674d923b2d8/ Changeset: a674d923b2d8 User: hpk42 Date: 2015-11-11 13:08:10+00:00 Summary: prepare 2.2.0 Affected #: 3 files diff -r bfb25dfb2e53f56d4d85cbd68b7af3c78538c88c -r a674d923b2d8987db4425262c0df9ca259546020 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,5 @@ -2.1.2 (dev) ------------ +2.2.0 +----- - fix issue265 and add LD_LIBRARY_PATH to passenv on linux by default because otherwise the python interpreter might not start up in diff -r bfb25dfb2e53f56d4d85cbd68b7af3c78538c88c -r a674d923b2d8987db4425262c0df9ca259546020 setup.py --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='2.1.2.dev1', + version='2.2.0', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r bfb25dfb2e53f56d4d85cbd68b7af3c78538c88c -r a674d923b2d8987db4425262c0df9ca259546020 tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.1.2.dev1' +__version__ = '2.2.0' from .hookspecs import hookspec, hookimpl # noqa https://bitbucket.org/hpk42/tox/commits/27eb2c5c9903/ Changeset: 27eb2c5c9903 User: hpk42 Date: 2015-11-11 13:08:42+00:00 Summary: Added tag 2.2.0 for changeset a674d923b2d8 Affected #: 1 file diff -r a674d923b2d8987db4425262c0df9ca259546020 -r 27eb2c5c99036625560b5757beb6290b4f361332 .hgtags --- a/.hgtags +++ b/.hgtags @@ -28,3 +28,4 @@ 82561ff2cbf48d8bf5be1384f5f3bd04c805fd30 2.0.2 25c76c46dbdd91126d2c6696cc1b4e97db6588f6 2.1.0 09fd6a94e2812f6cdfddfc6979be9b481af802a3 2.1.1 +a674d923b2d8987db4425262c0df9ca259546020 2.2.0 https://bitbucket.org/hpk42/tox/commits/49d4884aba78/ Changeset: 49d4884aba78 User: hpk42 Date: 2015-11-11 13:17:20+00:00 Summary: doc ignore_outcome and bump doc version Affected #: 2 files diff -r 27eb2c5c99036625560b5757beb6290b4f361332 -r 49d4884aba78ec17864c5b1a444fb5305fd0d93e doc/conf.py --- a/doc/conf.py +++ b/doc/conf.py @@ -48,8 +48,8 @@ # built documents. # # The short X.Y version. -release = "2.1" -version = "2.1.0" +release = "2.2" +version = "2.2.0" # The full version, including alpha/beta/rc tags. # The language for content autogenerated by Sphinx. Refer to documentation diff -r 27eb2c5c99036625560b5757beb6290b4f361332 -r 49d4884aba78ec17864c5b1a444fb5305fd0d93e doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -302,6 +302,15 @@ **default**: ``False`` +.. confval:: ignore_outcome=BOOL + + .. versionadded:: 2.2 + + If set to True a failing result of this testenv will not make tox fail, + only a warning will be produced. + + **default**: ``False`` + Substitutions ------------- https://bitbucket.org/hpk42/tox/commits/41090d8cb053/ Changeset: 41090d8cb053 User: hpk42 Date: 2015-11-11 13:47:33+00:00 Summary: Added tag 2.2.0 for changeset 49d4884aba78 Affected #: 1 file diff -r 49d4884aba78ec17864c5b1a444fb5305fd0d93e -r 41090d8cb0538a1d9ed0706c678ffe791f1671d7 .hgtags --- a/.hgtags +++ b/.hgtags @@ -29,3 +29,5 @@ 25c76c46dbdd91126d2c6696cc1b4e97db6588f6 2.1.0 09fd6a94e2812f6cdfddfc6979be9b481af802a3 2.1.1 a674d923b2d8987db4425262c0df9ca259546020 2.2.0 +a674d923b2d8987db4425262c0df9ca259546020 2.2.0 +49d4884aba78ec17864c5b1a444fb5305fd0d93e 2.2.0 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. From commits-noreply at bitbucket.org Wed Nov 11 10:16:30 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 11 Nov 2015 15:16:30 -0000 Subject: [Pytest-commit] commit/tox: 2 new changesets Message-ID: <20151111151630.71514.31508@celery-worker-102.ash1.bb-inf.net> 2 new commits in tox: https://bitbucket.org/hpk42/tox/commits/bc147d78aa43/ Changeset: bc147d78aa43 User: hpk42 Date: 2015-11-11 14:58:33+00:00 Summary: fix setenv/substitution bug Affected #: 5 files diff -r 41090d8cb0538a1d9ed0706c678ffe791f1671d7 -r bc147d78aa43853a0a7c825da1bb2b68ca034a2c CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +2.2.1 +----- + +- fix bug where {envdir} substitution could not be used in setenv + if that env value is then used in {basepython}. Thanks Florian Bruhin. + 2.2.0 ----- diff -r 41090d8cb0538a1d9ed0706c678ffe791f1671d7 -r bc147d78aa43853a0a7c825da1bb2b68ca034a2c setup.py --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='2.2.0', + version='2.2.1', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r 41090d8cb0538a1d9ed0706c678ffe791f1671d7 -r bc147d78aa43853a0a7c825da1bb2b68ca034a2c tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -738,6 +738,32 @@ assert envconfig.setenv['PYTHONPATH'] == 'something' assert envconfig.setenv['ANOTHER_VAL'] == 'else' + def test_setenv_with_envdir_and_basepython(self, tmpdir, newconfig): + config = newconfig(""" + [testenv] + setenv = + VAL = {envdir} + basepython = {env:VAL} + """) + assert len(config.envconfigs) == 1 + envconfig = config.envconfigs['python'] + assert 'VAL' in envconfig.setenv + assert envconfig.setenv['VAL'] == envconfig.envdir + assert envconfig.basepython == envconfig.envdir + + def test_setenv_ordering_1(self, tmpdir, newconfig): + config = newconfig(""" + [testenv] + setenv= + VAL={envdir} + commands=echo {env:VAL} + """) + assert len(config.envconfigs) == 1 + envconfig = config.envconfigs['python'] + assert 'VAL' in envconfig.setenv + assert envconfig.setenv['VAL'] == envconfig.envdir + assert str(envconfig.envdir) in envconfig.commands[0] + @pytest.mark.parametrize("plat", ["win32", "linux2"]) def test_passenv_as_multiline_list(self, tmpdir, newconfig, monkeypatch, plat): monkeypatch.setattr(sys, "platform", plat) diff -r 41090d8cb0538a1d9ed0706c678ffe791f1671d7 -r bc147d78aa43853a0a7c825da1bb2b68ca034a2c tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.2.0' +__version__ = '2.2.1' from .hookspecs import hookspec, hookimpl # noqa diff -r 41090d8cb0538a1d9ed0706c678ffe791f1671d7 -r bc147d78aa43853a0a7c825da1bb2b68ca034a2c tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -324,6 +324,10 @@ help="additional arguments available to command positional substitution") # add various core venv interpreter attributes + parser.add_testenv_attribute( + name="envdir", type="path", default="{toxworkdir}/{envname}", + help="venv directory") + def basepython_default(testenv_config, value): if value is None: for f in testenv_config.factors: @@ -338,10 +342,6 @@ "virtual test environment.") parser.add_testenv_attribute( - name="envdir", type="path", default="{toxworkdir}/{envname}", - help="venv directory") - - parser.add_testenv_attribute( name="envtmpdir", type="path", default="{envdir}/tmp", help="venv temporary directory") @@ -716,7 +716,7 @@ if atype == "path": reader.addsubstitutions(**{env_attr.name: res}) - if env_attr.name == "envdir": + if env_attr.name == "basepython": reader.addsubstitutions(envbindir=vc.envbindir, envpython=vc.envpython, envsitepackagesdir=vc.envsitepackagesdir) return vc https://bitbucket.org/hpk42/tox/commits/f6cca79ba7f6/ Changeset: f6cca79ba7f6 User: hpk42 Date: 2015-11-11 15:14:10+00:00 Summary: Added tag 2.2.1 for changeset bc147d78aa43 Affected #: 1 file diff -r bc147d78aa43853a0a7c825da1bb2b68ca034a2c -r f6cca79ba7f6522893ab720e1a5d09ab38fd3543 .hgtags --- a/.hgtags +++ b/.hgtags @@ -31,3 +31,4 @@ a674d923b2d8987db4425262c0df9ca259546020 2.2.0 a674d923b2d8987db4425262c0df9ca259546020 2.2.0 49d4884aba78ec17864c5b1a444fb5305fd0d93e 2.2.0 +bc147d78aa43853a0a7c825da1bb2b68ca034a2c 2.2.1 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. From issues-reply at bitbucket.org Wed Nov 11 12:28:27 2015 From: issues-reply at bitbucket.org (Ihar Hrachyshka) Date: Wed, 11 Nov 2015 17:28:27 -0000 Subject: [Pytest-commit] Issue #285: tox 2.2.0+ breaks some tox.ini config files due to recursion issue (hpk42/tox) Message-ID: <20151111172827.51661.65820@celery-worker-102.ash1.bb-inf.net> New issue 285: tox 2.2.0+ breaks some tox.ini config files due to recursion issue https://bitbucket.org/hpk42/tox/issues/285/tox-220-breaks-some-toxini-config-files Ihar Hrachyshka: tox 2.2.0+ breaks the following projects in OpenStack: http://codesearch.openstack.org/?q=%3D\{env%3A.*%3F%3A.*%3F\}&i=nope&files=tox.ini&repos= networking-l2gw, networking-vsphere, neutron, neutron-lbaas, and python-fuelclient The OpenStack bug for the failure is: https://bugs.launchpad.net/neutron/+bug/1515335 The logs of the failure can be found at: http://logs.openstack.org/22/244122/2/gate/gate-neutron-python27/414e071/console.html#_2015-11-11_16_10_42_148 The line in tox.ini that triggers it is: https://github.com/openstack/neutron/blob/master/tox.ini#L26 Copying the section that triggers the issue here just in case: [testenv:api] basepython = python2.7 setenv = {[testenv]setenv} OS_TEST_PATH=./neutron/tests/api TEMPEST_CONFIG_DIR={env:TEMPEST_CONFIG_DIR:/opt/stack/tempest/etc} OS_TEST_API_WITH_REST=1 The problematic line is the one setting TEMPEST_CONFIG_DIR. From issues-reply at bitbucket.org Thu Nov 12 05:50:30 2015 From: issues-reply at bitbucket.org (Maik Figura) Date: Thu, 12 Nov 2015 10:50:30 -0000 Subject: [Pytest-commit] Issue #286: tox freezes when pip installing from vcs in requirements.txt (hpk42/tox) Message-ID: <20151112105030.37229.60349@celery-worker-101.ash1.bb-inf.net> New issue 286: tox freezes when pip installing from vcs in requirements.txt https://bitbucket.org/hpk42/tox/issues/286/tox-freezes-when-pip-installing-from-vcs Maik Figura: I am using tox to pip install dependencies from a `requirements.txt` file.One of these dependencies is a repository. We are using pip's facility to install directly from the vcs: http://pip.readthedocs.org/en/stable/reference/pip_install/#git I noticed that when the environments are created everything is fine, but as soon as I run `tox -r` and the environment with the cloned dependency inside exists, tox freezes, because it tries to clone the repository again but fails (as it already exists). Currently, the only solution to is to manually delete the environment (in my case the `.tox` folder). From commits-noreply at bitbucket.org Fri Nov 13 04:49:28 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 13 Nov 2015 09:49:28 -0000 Subject: [Pytest-commit] commit/tox: 3 new changesets Message-ID: <20151113094928.6395.43833@celery-worker-101.ash1.bb-inf.net> 3 new commits in tox: https://bitbucket.org/hpk42/tox/commits/f6fc0af4ceb5/ Changeset: f6fc0af4ceb5 Branch: issue285 User: hpk42 Date: 2015-11-13 09:48:43+00:00 Summary: add various xfailing test cases for env substitution in setenv Affected #: 1 file diff -r f6cca79ba7f6522893ab720e1a5d09ab38fd3543 -r f6fc0af4ceb5e0b313008ffe7f1a523ffe8d7fc1 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1598,6 +1598,47 @@ self._check_hashseed(envconfigs["hash2"], '123456789') +class TestSetenv: + @pytest.mark.xfail(reason="fix pending") + def test_setenv_uses_os_environ(self, tmpdir, newconfig, monkeypatch): + monkeypatch.setenv("X", "1") + config = newconfig(""" + [testenv:env1] + setenv = + X = {env:X} + """) + assert config.envconfigs["env1"].setenv["X"] == "1" + + @pytest.mark.xfail(reason="fix pending") + def test_setenv_default_os_environ(self, tmpdir, newconfig, monkeypatch): + monkeypatch.delenv("X", raising=False) + config = newconfig(""" + [testenv:env1] + setenv = + X = {env:X:2} + """) + assert config.envconfigs["env1"].setenv["X"] == "2" + + @pytest.mark.xfail(reason="fix pending") + def test_setenv_uses_other_setenv(self, tmpdir, newconfig): + config = newconfig(""" + [testenv:env1] + setenv = + Y = 5 + X = {env:Y} + """) + assert config.envconfigs["env1"].setenv["X"] == "5" + + @pytest.mark.xfail(reason="fix pending") + def test_setenv_recursive_direct(self, tmpdir, newconfig): + config = newconfig(""" + [testenv:env1] + setenv = + X = {env:X:3} + """) + assert config.envconfigs["env1"].setenv["X"] == "3" + + class TestIndexServer: def test_indexserver(self, tmpdir, newconfig): config = newconfig(""" https://bitbucket.org/hpk42/tox/commits/fd4af25ed954/ Changeset: fd4af25ed954 Branch: issue285 User: hpk42 Date: 2015-11-13 09:48:45+00:00 Summary: put replacing/substitution into own class Affected #: 1 file diff -r f6fc0af4ceb5e0b313008ffe7f1a523ffe8d7fc1 -r fd4af25ed9541539b969146305375064320666cd tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -799,16 +799,6 @@ is_section_substitution = re.compile("{\[[^{}\s]+\]\S+?}").match -RE_ITEM_REF = re.compile( - r''' - (?[^[:{}]+):)? # optional sub_type for special rules - (?P[^{}]*) # substitution key - [}] - ''', - re.VERBOSE) - - class SectionReader: def __init__(self, section_name, cfgparser, fallbacksections=None, factors=()): self.section_name = section_name @@ -888,11 +878,7 @@ x = self._apply_factors(x) if replace and x and hasattr(x, 'replace'): - self._subststack.append((self.section_name, name)) - try: - x = self._replace(x) - finally: - assert self._subststack.pop() == (self.section_name, name) + x = self._replace(x, name=name) # print "getstring", self.section_name, name, "returned", repr(x) return x @@ -909,8 +895,61 @@ lines = s.strip().splitlines() return '\n'.join(filter(None, map(factor_line, lines))) + def _replace(self, value, name=None, section_name=None): + if '{' not in value: + return value + + section_name = section_name if section_name else self.section_name + self._subststack.append((section_name, name)) + try: + return Replacer(self).do_replace(value) + finally: + assert self._subststack.pop() == (section_name, name) + + +class Replacer: + RE_ITEM_REF = re.compile( + r''' + (?[^[:{}]+):)? # optional sub_type for special rules + (?P[^{}]*) # substitution key + [}] + ''', + re.VERBOSE) + + + def __init__(self, reader, opt_replace_env=True): + self.reader = reader + self.opt_replace_env = opt_replace_env + + def do_replace(self, x): + return self.RE_ITEM_REF.sub(self._replace_match, x) + + def _replace_match(self, match): + g = match.groupdict() + + # special case: opts and packages. Leave {opts} and + # {packages} intact, they are replaced manually in + # _venv.VirtualEnv.run_install_command. + sub_value = g['substitution_value'] + if sub_value in ('opts', 'packages'): + return '{%s}' % sub_value + + try: + sub_type = g['sub_type'] + except KeyError: + raise tox.exception.ConfigError( + "Malformed substitution; no substitution type provided") + + if sub_type == "env": + assert self.opt_replace_env + return self._replace_env(match) + if sub_type != None: + raise tox.exception.ConfigError("No support for the %s substitution type" % sub_type) + return self._replace_substitution(match) + def _replace_env(self, match): - env_list = self.getdict('setenv') + env_list = self.reader.getdict('setenv') match_value = match.group('substitution_value') if not match_value: raise tox.exception.ConfigError( @@ -938,60 +977,26 @@ if key.startswith("[") and "]" in key: i = key.find("]") section, item = key[1:i], key[i + 1:] - if section in self._cfg and item in self._cfg[section]: - if (section, item) in self._subststack: + cfg = self.reader._cfg + if section in cfg and item in cfg[section]: + if (section, item) in self.reader._subststack: raise ValueError('%s already in %s' % ( - (section, item), self._subststack)) - x = str(self._cfg[section][item]) - self._subststack.append((section, item)) - try: - return self._replace(x) - finally: - self._subststack.pop() + (section, item), self.reader._subststack)) + x = str(cfg[section][item]) + return self.reader._replace(x, name=item, section_name=section) raise tox.exception.ConfigError( "substitution key %r not found" % key) def _replace_substitution(self, match): sub_key = match.group('substitution_value') - val = self._subs.get(sub_key, None) + val = self.reader._subs.get(sub_key, None) if val is None: val = self._substitute_from_other_section(sub_key) if py.builtin.callable(val): val = val() return str(val) - def _replace_match(self, match): - g = match.groupdict() - - # special case: opts and packages. Leave {opts} and - # {packages} intact, they are replaced manually in - # _venv.VirtualEnv.run_install_command. - sub_value = g['substitution_value'] - if sub_value in ('opts', 'packages'): - return '{%s}' % sub_value - - handlers = { - 'env': self._replace_env, - None: self._replace_substitution, - } - try: - sub_type = g['sub_type'] - except KeyError: - raise tox.exception.ConfigError( - "Malformed substitution; no substitution type provided") - - try: - handler = handlers[sub_type] - except KeyError: - raise tox.exception.ConfigError("No support for the %s substitution type" % sub_type) - - return handler(match) - - def _replace(self, x): - if '{' in x: - return RE_ITEM_REF.sub(self._replace_match, x) - return x class _ArgvlistReader: https://bitbucket.org/hpk42/tox/commits/a6d3e1956d85/ Changeset: a6d3e1956d85 Branch: issue285 User: hpk42 Date: 2015-11-13 09:49:05+00:00 Summary: address issue285 but not fully resolve it: setenv processing now works, making all config tests pass except for one substitution issue which requires yet some more logic, probably. Affected #: 2 files diff -r fd4af25ed9541539b969146305375064320666cd -r a6d3e1956d8516889b1ee3275257e397fe1dfd51 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -283,18 +283,9 @@ commands = ls {env:TEST} """) - reader = SectionReader("testenv:py27", config._cfg) - x = reader.getargvlist("commands") - assert x == [ - "ls testvalue".split() - ] - assert x != [ - "ls {env:TEST}".split() - ] - y = reader.getargvlist("setenv") - assert y == [ - "TEST=testvalue".split() - ] + envconfig = config.envconfigs["py27"] + assert envconfig.commands == [["ls", "testvalue"]] + assert envconfig.setenv["TEST"] == "testvalue" class TestIniParser: @@ -1599,7 +1590,19 @@ class TestSetenv: - @pytest.mark.xfail(reason="fix pending") + def test_getdict_lazy(self, tmpdir, newconfig): + config = newconfig(""" + [testenv:X] + key0 = + key1 = {env:X} + key2 = {env:X:1} + """) + envconfig = config.envconfigs["X"] + val = envconfig._reader.getdict_lazy("key0") + assert val == {"key1": "{env:X}", + "key2": "{env:X:1}"} + + def test_setenv_uses_os_environ(self, tmpdir, newconfig, monkeypatch): monkeypatch.setenv("X", "1") config = newconfig(""" @@ -1609,7 +1612,6 @@ """) assert config.envconfigs["env1"].setenv["X"] == "1" - @pytest.mark.xfail(reason="fix pending") def test_setenv_default_os_environ(self, tmpdir, newconfig, monkeypatch): monkeypatch.delenv("X", raising=False) config = newconfig(""" @@ -1619,7 +1621,6 @@ """) assert config.envconfigs["env1"].setenv["X"] == "2" - @pytest.mark.xfail(reason="fix pending") def test_setenv_uses_other_setenv(self, tmpdir, newconfig): config = newconfig(""" [testenv:env1] @@ -1629,7 +1630,6 @@ """) assert config.envconfigs["env1"].setenv["X"] == "5" - @pytest.mark.xfail(reason="fix pending") def test_setenv_recursive_direct(self, tmpdir, newconfig): config = newconfig(""" [testenv:env1] diff -r fd4af25ed9541539b969146305375064320666cd -r a6d3e1956d8516889b1ee3275257e397fe1dfd51 tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -323,11 +323,39 @@ parser.add_argument("args", nargs="*", help="additional arguments available to command positional substitution") - # add various core venv interpreter attributes parser.add_testenv_attribute( name="envdir", type="path", default="{toxworkdir}/{envname}", help="venv directory") + # add various core venv interpreter attributes + def setenv(testenv_config, value): + setenv = value + reader = testenv_config._reader + + # we need to resolve environment variable substitution + + replacing = [] # for detecting direct recursion + def setenv_reader(name): + if name in setenv and name not in replacing: + return setenv[name] + return os.environ.get(name) + reader.set_envreader(setenv_reader) + + for name, value in setenv.items(): + replacing.append(name) + setenv[name] = reader._replace(value) + replacing.pop() + + config = testenv_config.config + if "PYTHONHASHSEED" not in setenv and config.hashseed is not None: + setenv['PYTHONHASHSEED'] = config.hashseed + return setenv + + parser.add_testenv_attribute( + name="setenv", type="dict_lazy", postprocess=setenv, + help="list of X=Y lines with environment variable settings") + + def basepython_default(testenv_config, value): if value is None: for f in testenv_config.factors: @@ -385,17 +413,6 @@ name="recreate", type="bool", default=False, postprocess=recreate, help="always recreate this test environment.") - def setenv(testenv_config, value): - setenv = value - config = testenv_config.config - if "PYTHONHASHSEED" not in setenv and config.hashseed is not None: - setenv['PYTHONHASHSEED'] = config.hashseed - return setenv - - parser.add_testenv_attribute( - name="setenv", type="dict", postprocess=setenv, - help="list of X=Y lines with environment variable settings") - def passenv(testenv_config, value): # Flatten the list to deal with space-separated values. value = list( @@ -518,21 +535,15 @@ @property def envbindir(self): """ path to directory where scripts/binaries reside. """ - if (sys.platform == "win32" - and "jython" not in self.basepython - and "pypy" not in self.basepython): + if sys.platform == "win32": return self.envdir.join("Scripts") else: return self.envdir.join("bin") @property def envpython(self): - """ path to python/jython executable. """ - if "jython" in str(self.basepython): - name = "jython" - else: - name = "python" - return self.envbindir.join(name) + """ path to python executable. """ + return self.envbindir.join(self.basepython) # no @property to avoid early calling (see callable(subst[key]) checks) def envsitepackagesdir(self): @@ -699,7 +710,7 @@ for env_attr in config._testenv_attr: atype = env_attr.type - if atype in ("bool", "path", "string", "dict", "argv", "argvlist"): + if atype in ("bool", "path", "string", "dict", "dict_lazy", "argv", "argvlist"): meth = getattr(reader, "get" + atype) res = meth(env_attr.name, env_attr.default) elif atype == "space-separated-list": @@ -807,6 +818,13 @@ self.factors = factors self._subs = {} self._subststack = [] + self._envreader = os.environ.get + + def set_envreader(self, envreader): + self._envreader = envreader + + def get_environ_value(self, name): + return self._envreader(name) def addsubstitutions(self, _posargs=None, **kw): self._subs.update(kw) @@ -826,17 +844,24 @@ return [x.strip() for x in s.split(sep) if x.strip()] def getdict(self, name, default=None, sep="\n"): - s = self.getstring(name, None) - if s is None: + value = self.getstring(name, None) + return self._getdict(value, default=default, sep=sep) + + def getdict_lazy(self, name, default=None, sep="\n"): + value = self.getstring(name, None, replace="noenv") + return self._getdict(value, default=default, sep=sep) + + def _getdict(self, value, default, sep): + if value is None: return default or {} - value = {} - for line in s.split(sep): + d = {} + for line in value.split(sep): if line.strip(): name, rest = line.split('=', 1) - value[name.strip()] = rest.strip() + d[name.strip()] = rest.strip() - return value + return d def getbool(self, name, default=None): s = self.getstring(name, default) @@ -878,7 +903,7 @@ x = self._apply_factors(x) if replace and x and hasattr(x, 'replace'): - x = self._replace(x, name=name) + x = self._replace(x, name=name, opt_replace_env=(replace!="noenv")) # print "getstring", self.section_name, name, "returned", repr(x) return x @@ -895,14 +920,14 @@ lines = s.strip().splitlines() return '\n'.join(filter(None, map(factor_line, lines))) - def _replace(self, value, name=None, section_name=None): + def _replace(self, value, name=None, section_name=None, opt_replace_env=True): if '{' not in value: return value section_name = section_name if section_name else self.section_name self._subststack.append((section_name, name)) try: - return Replacer(self).do_replace(value) + return Replacer(self, opt_replace_env=opt_replace_env).do_replace(value) finally: assert self._subststack.pop() == (section_name, name) @@ -918,7 +943,7 @@ re.VERBOSE) - def __init__(self, reader, opt_replace_env=True): + def __init__(self, reader, opt_replace_env): self.reader = reader self.opt_replace_env = opt_replace_env @@ -942,14 +967,14 @@ "Malformed substitution; no substitution type provided") if sub_type == "env": - assert self.opt_replace_env - return self._replace_env(match) + if self.opt_replace_env: + return self._replace_env(match) + return "{env:%s}" %(g["substitution_value"]) if sub_type != None: raise tox.exception.ConfigError("No support for the %s substitution type" % sub_type) return self._replace_substitution(match) def _replace_env(self, match): - env_list = self.reader.getdict('setenv') match_value = match.group('substitution_value') if not match_value: raise tox.exception.ConfigError( @@ -963,15 +988,14 @@ else: envkey = match_value - if envkey not in os.environ and default is None: - if envkey not in env_list and default is None: + envvalue = self.reader.get_environ_value(envkey) + if envvalue is None: + if default is None: raise tox.exception.ConfigError( "substitution env:%r: unknown environment variable %r" % (envkey, envkey)) - if envkey in os.environ: - return os.environ.get(envkey, default) - else: - return env_list.get(envkey, default) + return default + return envvalue def _substitute_from_other_section(self, key): if key.startswith("[") and "]" in key: @@ -983,7 +1007,8 @@ raise ValueError('%s already in %s' % ( (section, item), self.reader._subststack)) x = str(cfg[section][item]) - return self.reader._replace(x, name=item, section_name=section) + return self.reader._replace(x, name=item, section_name=section, + opt_replace_env=self.opt_replace_env) raise tox.exception.ConfigError( "substitution key %r not found" % key) 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. From commits-noreply at bitbucket.org Fri Nov 13 04:51:26 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 13 Nov 2015 09:51:26 -0000 Subject: [Pytest-commit] commit/tox: hpk42: add changelog Message-ID: <20151113095126.62153.3299@celery-worker-102.ash1.bb-inf.net> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/ecae8369beda/ Changeset: ecae8369beda Branch: issue285 User: hpk42 Date: 2015-11-13 09:50:44+00:00 Summary: add changelog Affected #: 3 files diff -r a6d3e1956d8516889b1ee3275257e397fe1dfd51 -r ecae8369bedafddaeda73e16e2622e55011919c8 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2.2.2.dev +--------- + +- fix issue285 (WIP) setenv processing with self-references + 2.2.1 ----- diff -r a6d3e1956d8516889b1ee3275257e397fe1dfd51 -r ecae8369bedafddaeda73e16e2622e55011919c8 setup.py --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='2.2.1', + version='2.2.2.dev1', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r a6d3e1956d8516889b1ee3275257e397fe1dfd51 -r ecae8369bedafddaeda73e16e2622e55011919c8 tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.2.1' +__version__ = '2.2.2.dev1' from .hookspecs import hookspec, hookimpl # noqa 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. From issues-reply at bitbucket.org Thu Nov 19 14:33:07 2015 From: issues-reply at bitbucket.org (Vitor Baptista) Date: Thu, 19 Nov 2015 19:33:07 -0000 Subject: [Pytest-commit] Issue #287: Detect if we're running on Travis (hpk42/tox) Message-ID: <20151119193307.7311.40149@celery-worker-101.ash1.bb-inf.net> New issue 287: Detect if we're running on Travis https://bitbucket.org/hpk42/tox/issues/287/detect-if-were-running-on-travis Vitor Baptista: Hi, The same way we can do `[testenv:jenkins]` to customize the environment for jenkins, it should be easy to do `[testenv:travis]`. Travis sets the environment variable `TRAVIS=true` by default (http://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables). My use-case for this is to run coveralls only when running on travis. There are a few workarounds, as in https://stackoverflow.com/questions/32757765/conditional-commands-in-tox-tox-travis-ci-and-coveralls, but they involve running a small python script. It would be much cleaner if Tox supported it, and as it already does something similar for Jenkins, it would be trivial. If you think it's useful, I'd be happy to prepare a pull request. Cheers, Vitor. From issues-reply at bitbucket.org Fri Nov 20 02:57:37 2015 From: issues-reply at bitbucket.org (kozhukalov) Date: Fri, 20 Nov 2015 07:57:37 -0000 Subject: [Pytest-commit] Issue #288: Recursive replacement when getdict('setenv') (hpk42/tox) Message-ID: <20151120075737.46953.3276@celery-worker-102.ash1.bb-inf.net> New issue 288: Recursive replacement when getdict('setenv') https://bitbucket.org/hpk42/tox/issues/288/recursive-replacement-when-getdict-setenv kozhukalov: The thing is that when config.py module replaces macros in setenv dict, it calls getdict('setenv') which recursively tries to replace macros. So, python reports 'maximum recursion depth exceeded' error. This patch fixes the issue ``` --- a/tox/config.py Wed Nov 11 15:58:33 2015 +0100 +++ b/tox/config.py Fri Nov 20 10:45:40 2015 +0300 @@ -835,8 +835,8 @@ return [] return [x.strip() for x in s.split(sep) if x.strip()] - def getdict(self, name, default=None, sep="\n"): - s = self.getstring(name, None) + def getdict(self, name, default=None, sep="\n", replace=True): + s = self.getstring(name, None, replace=replace) if s is None: return default or {} @@ -910,7 +910,7 @@ return '\n'.join(filter(None, map(factor_line, lines))) def _replace_env(self, match): - env_list = self.getdict('setenv') + env_list = self.getdict('setenv', replace=False) match_value = match.group('substitution_value') if not match_value: raise tox.exception.ConfigError( ``` From commits-noreply at bitbucket.org Fri Nov 20 07:36:13 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 20 Nov 2015 12:36:13 -0000 Subject: [Pytest-commit] commit/tox: hpk42: Merged in dstanek/tox/bug_181 (pull request #174) Message-ID: <20151120123613.52211.98411@celery-worker-102.ash1.bb-inf.net> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/ec6f11289851/ Changeset: ec6f11289851 User: hpk42 Date: 2015-11-20 12:36:09+00:00 Summary: Merged in dstanek/tox/bug_181 (pull request #174) Fixes bug 181; allow # in commands Affected #: 2 files diff -r f6cca79ba7f6522893ab720e1a5d09ab38fd3543 -r ec6f11289851f9c08e7f5be35dedb0e6adc11506 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -459,7 +459,7 @@ config = newconfig(""" [section] key2= - cmd1 {item1} \ # a comment + cmd1 {item1} \ {item2} """) reader = SectionReader("section", config._cfg) @@ -474,12 +474,32 @@ config = newconfig(""" [section] key1= - cmd1 'with space' \ # a comment - 'after the comment' + cmd1 'part one' \ + 'part two' """) reader = SectionReader("section", config._cfg) x = reader.getargvlist("key1") - assert x == [["cmd1", "with space", "after the comment"]] + assert x == [["cmd1", "part one", "part two"]] + + def test_argvlist_comment_after_command(self, tmpdir, newconfig): + config = newconfig(""" + [section] + key1= + cmd1 --flag # run the flag on the command + """) + reader = SectionReader("section", config._cfg) + x = reader.getargvlist("key1") + assert x == [["cmd1", "--flag"]] + + def test_argvlist_command_contains_hash(self, tmpdir, newconfig): + config = newconfig(""" + [section] + key1= + cmd1 --re "use the # symbol for an arg" + """) + reader = SectionReader("section", config._cfg) + x = reader.getargvlist("key1") + assert x == [["cmd1", "--re", "use the # symbol for an arg"]] def test_argvlist_positional_substitution(self, tmpdir, newconfig): config = newconfig(""" diff -r f6cca79ba7f6522893ab720e1a5d09ab38fd3543 -r ec6f11289851f9c08e7f5be35dedb0e6adc11506 tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -1010,9 +1010,6 @@ current_command = "" for line in value.splitlines(): line = line.rstrip() - i = line.find("#") - if i != -1: - line = line[:i].rstrip() if not line: continue if line.endswith("\\"): @@ -1064,7 +1061,6 @@ shlexer = shlex.shlex(newcommand, posix=True) shlexer.whitespace_split = True shlexer.escape = '' - shlexer.commenters = '' argv = list(shlexer) return argv 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. From commits-noreply at bitbucket.org Fri Nov 20 07:36:12 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 20 Nov 2015 12:36:12 -0000 Subject: [Pytest-commit] commit/tox: 2 new changesets Message-ID: <20151120123612.72869.92746@celery-worker-102.ash1.bb-inf.net> 2 new commits in tox: https://bitbucket.org/hpk42/tox/commits/267db03b41e9/ Changeset: 267db03b41e9 Branch: bug_181 User: dstanek Date: 2015-10-05 18:23:35+00:00 Summary: Fixes bug 181; allow # in commands If a # was in a command the original code naively removed it and everything after assuming it was a comment. This meant that a # could not be used in a command even if it was quoted or escaped. This fix is backward incompatible because it no longer allows a comment to appear after a line escape (\). I think is is acceptable because in most other environments a backslash would preceed a newline to escape it and tell the interpreter to ignore it. This brings tox's command behavior more in line with what Unix shells or Python actually do. Affected #: 2 files diff -r 3ed5dc353a99acf57859a2dd265b5c2e973480e3 -r 267db03b41e91ad5a4eebcef6fefd037b42e3410 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -417,7 +417,7 @@ config = newconfig(""" [section] key2= - cmd1 {item1} \ # a comment + cmd1 {item1} \ {item2} """) reader = SectionReader("section", config._cfg) @@ -432,12 +432,32 @@ config = newconfig(""" [section] key1= - cmd1 'with space' \ # a comment - 'after the comment' + cmd1 'part one' \ + 'part two' """) reader = SectionReader("section", config._cfg) x = reader.getargvlist("key1") - assert x == [["cmd1", "with space", "after the comment"]] + assert x == [["cmd1", "part one", "part two"]] + + def test_argvlist_comment_after_command(self, tmpdir, newconfig): + config = newconfig(""" + [section] + key1= + cmd1 --flag # run the flag on the command + """) + reader = SectionReader("section", config._cfg) + x = reader.getargvlist("key1") + assert x == [["cmd1", "--flag"]] + + def test_argvlist_command_contains_hash(self, tmpdir, newconfig): + config = newconfig(""" + [section] + key1= + cmd1 --re "use the # symbol for an arg" + """) + reader = SectionReader("section", config._cfg) + x = reader.getargvlist("key1") + assert x == [["cmd1", "--re", "use the # symbol for an arg"]] def test_argvlist_positional_substitution(self, tmpdir, newconfig): config = newconfig(""" diff -r 3ed5dc353a99acf57859a2dd265b5c2e973480e3 -r 267db03b41e91ad5a4eebcef6fefd037b42e3410 tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -999,9 +999,6 @@ current_command = "" for line in value.splitlines(): line = line.rstrip() - i = line.find("#") - if i != -1: - line = line[:i].rstrip() if not line: continue if line.endswith("\\"): @@ -1053,7 +1050,6 @@ shlexer = shlex.shlex(newcommand, posix=True) shlexer.whitespace_split = True shlexer.escape = '' - shlexer.commenters = '' argv = list(shlexer) return argv https://bitbucket.org/hpk42/tox/commits/ec6f11289851/ Changeset: ec6f11289851 User: hpk42 Date: 2015-11-20 12:36:09+00:00 Summary: Merged in dstanek/tox/bug_181 (pull request #174) Fixes bug 181; allow # in commands Affected #: 2 files diff -r f6cca79ba7f6522893ab720e1a5d09ab38fd3543 -r ec6f11289851f9c08e7f5be35dedb0e6adc11506 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -459,7 +459,7 @@ config = newconfig(""" [section] key2= - cmd1 {item1} \ # a comment + cmd1 {item1} \ {item2} """) reader = SectionReader("section", config._cfg) @@ -474,12 +474,32 @@ config = newconfig(""" [section] key1= - cmd1 'with space' \ # a comment - 'after the comment' + cmd1 'part one' \ + 'part two' """) reader = SectionReader("section", config._cfg) x = reader.getargvlist("key1") - assert x == [["cmd1", "with space", "after the comment"]] + assert x == [["cmd1", "part one", "part two"]] + + def test_argvlist_comment_after_command(self, tmpdir, newconfig): + config = newconfig(""" + [section] + key1= + cmd1 --flag # run the flag on the command + """) + reader = SectionReader("section", config._cfg) + x = reader.getargvlist("key1") + assert x == [["cmd1", "--flag"]] + + def test_argvlist_command_contains_hash(self, tmpdir, newconfig): + config = newconfig(""" + [section] + key1= + cmd1 --re "use the # symbol for an arg" + """) + reader = SectionReader("section", config._cfg) + x = reader.getargvlist("key1") + assert x == [["cmd1", "--re", "use the # symbol for an arg"]] def test_argvlist_positional_substitution(self, tmpdir, newconfig): config = newconfig(""" diff -r f6cca79ba7f6522893ab720e1a5d09ab38fd3543 -r ec6f11289851f9c08e7f5be35dedb0e6adc11506 tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -1010,9 +1010,6 @@ current_command = "" for line in value.splitlines(): line = line.rstrip() - i = line.find("#") - if i != -1: - line = line[:i].rstrip() if not line: continue if line.endswith("\\"): @@ -1064,7 +1061,6 @@ shlexer = shlex.shlex(newcommand, posix=True) shlexer.whitespace_split = True shlexer.escape = '' - shlexer.commenters = '' argv = list(shlexer) return argv 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. From issues-reply at bitbucket.org Fri Nov 20 16:23:29 2015 From: issues-reply at bitbucket.org (Barry Warsaw) Date: Fri, 20 Nov 2015 21:23:29 -0000 Subject: [Pytest-commit] Issue #289: python3 setup.py build_sphinx fails (hpk42/tox) Message-ID: <20151120212329.39446.15520@celery-worker-101.ash1.bb-inf.net> New issue 289: python3 setup.py build_sphinx fails https://bitbucket.org/hpk42/tox/issues/289/python3-setuppy-build_sphinx-fails Barry Warsaw: ``` % python3 setup.py build_sphinx running build_sphinx error: error in 'source_dir' option: 'doc/en/' does not exist or is not a directory ``` Changing this to ``` [build_sphinx] source-dir = doc ``` in setup.cfg fixes the problem. From commits-noreply at bitbucket.org Fri Nov 20 16:35:15 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 20 Nov 2015 21:35:15 -0000 Subject: [Pytest-commit] commit/tox: 2 new changesets Message-ID: <20151120213515.29392.9914@celery-worker-102.ash1.bb-inf.net> 2 new commits in tox: https://bitbucket.org/hpk42/tox/commits/c1ae0cd47fde/ Changeset: c1ae0cd47fde User: hpk42 Date: 2015-11-20 12:37:36+00:00 Summary: add changelog entry Affected #: 3 files diff -r ec6f11289851f9c08e7f5be35dedb0e6adc11506 -r c1ae0cd47fde5c2d4357b4a6e76d3af5f7e97631 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +2.3.0 (unreleased) +----- + +- allow "#" in commands. This is slightly incompatible with commands + sections that used a comment after a "\" line continuation. + Thanks David Stanek for the PR. + + 2.2.1 ----- diff -r ec6f11289851f9c08e7f5be35dedb0e6adc11506 -r c1ae0cd47fde5c2d4357b4a6e76d3af5f7e97631 setup.py --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='2.2.1', + version='2.3.0.dev1', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r ec6f11289851f9c08e7f5be35dedb0e6adc11506 -r c1ae0cd47fde5c2d4357b4a6e76d3af5f7e97631 tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.2.1' +__version__ = '2.3.0.dev1' from .hookspecs import hookspec, hookimpl # noqa https://bitbucket.org/hpk42/tox/commits/569f3abbc262/ Changeset: 569f3abbc262 User: hpk42 Date: 2015-11-20 21:29:28+00:00 Summary: fix issue289: fix build_sphinx target, thanks Barry Warsaw. Affected #: 2 files diff -r c1ae0cd47fde5c2d4357b4a6e76d3af5f7e97631 -r 569f3abbc262c7ec203d9a2e6bd38a14f13d410b CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,8 @@ sections that used a comment after a "\" line continuation. Thanks David Stanek for the PR. +- fix issue289: fix build_sphinx target, thanks Barry Warsaw. + 2.2.1 ----- diff -r c1ae0cd47fde5c2d4357b4a6e76d3af5f7e97631 -r 569f3abbc262c7ec203d9a2e6bd38a14f13d410b setup.cfg --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [build_sphinx] -source-dir = doc/en/ +source-dir = doc/ build-dir = doc/build all_files = 1 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. From commits-noreply at bitbucket.org Fri Nov 20 16:36:45 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 20 Nov 2015 21:36:45 -0000 Subject: [Pytest-commit] commit/tox: hpk42: merge default Message-ID: <20151120213645.31603.58860@celery-worker-101.ash1.bb-inf.net> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/0f1846de3af1/ Changeset: 0f1846de3af1 Branch: issue285 User: hpk42 Date: 2015-11-20 21:36:39+00:00 Summary: merge default Affected #: 6 files diff -r ecae8369bedafddaeda73e16e2622e55011919c8 -r 0f1846de3af1d21c3d33099c47ef7d961620f362 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,8 +1,15 @@ -2.2.2.dev ---------- +2.3.0 (unreleased) +----- - fix issue285 (WIP) setenv processing with self-references +- allow "#" in commands. This is slightly incompatible with commands + sections that used a comment after a "\" line continuation. + Thanks David Stanek for the PR. + +- fix issue289: fix build_sphinx target, thanks Barry Warsaw. + + 2.2.1 ----- diff -r ecae8369bedafddaeda73e16e2622e55011919c8 -r 0f1846de3af1d21c3d33099c47ef7d961620f362 setup.cfg --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [build_sphinx] -source-dir = doc/en/ +source-dir = doc/ build-dir = doc/build all_files = 1 diff -r ecae8369bedafddaeda73e16e2622e55011919c8 -r 0f1846de3af1d21c3d33099c47ef7d961620f362 setup.py --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='2.2.2.dev1', + version='2.3.0.dev1', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r ecae8369bedafddaeda73e16e2622e55011919c8 -r 0f1846de3af1d21c3d33099c47ef7d961620f362 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -450,7 +450,7 @@ config = newconfig(""" [section] key2= - cmd1 {item1} \ # a comment + cmd1 {item1} \ {item2} """) reader = SectionReader("section", config._cfg) @@ -465,12 +465,32 @@ config = newconfig(""" [section] key1= - cmd1 'with space' \ # a comment - 'after the comment' + cmd1 'part one' \ + 'part two' """) reader = SectionReader("section", config._cfg) x = reader.getargvlist("key1") - assert x == [["cmd1", "with space", "after the comment"]] + assert x == [["cmd1", "part one", "part two"]] + + def test_argvlist_comment_after_command(self, tmpdir, newconfig): + config = newconfig(""" + [section] + key1= + cmd1 --flag # run the flag on the command + """) + reader = SectionReader("section", config._cfg) + x = reader.getargvlist("key1") + assert x == [["cmd1", "--flag"]] + + def test_argvlist_command_contains_hash(self, tmpdir, newconfig): + config = newconfig(""" + [section] + key1= + cmd1 --re "use the # symbol for an arg" + """) + reader = SectionReader("section", config._cfg) + x = reader.getargvlist("key1") + assert x == [["cmd1", "--re", "use the # symbol for an arg"]] def test_argvlist_positional_substitution(self, tmpdir, newconfig): config = newconfig(""" diff -r ecae8369bedafddaeda73e16e2622e55011919c8 -r 0f1846de3af1d21c3d33099c47ef7d961620f362 tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.2.2.dev1' +__version__ = '2.3.0.dev1' from .hookspecs import hookspec, hookimpl # noqa diff -r ecae8369bedafddaeda73e16e2622e55011919c8 -r 0f1846de3af1d21c3d33099c47ef7d961620f362 tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -1040,9 +1040,6 @@ current_command = "" for line in value.splitlines(): line = line.rstrip() - i = line.find("#") - if i != -1: - line = line[:i].rstrip() if not line: continue if line.endswith("\\"): @@ -1094,7 +1091,6 @@ shlexer = shlex.shlex(newcommand, posix=True) shlexer.whitespace_split = True shlexer.escape = '' - shlexer.commenters = '' argv = list(shlexer) return argv 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. From commits-noreply at bitbucket.org Wed Nov 25 06:27:50 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 25 Nov 2015 11:27:50 -0000 Subject: [Pytest-commit] commit/tox: hpk42: Merged in ionelmc/tox-1/ionelmc/correct-incorrect-docs-on-platform-1448372605209 (pull request #180) Message-ID: <20151125112750.23216.88966@celery-worker-101.ash1.bb-inf.net> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/e9569646da4f/ Changeset: e9569646da4f User: hpk42 Date: 2015-11-25 11:27:48+00:00 Summary: Merged in ionelmc/tox-1/ionelmc/correct-incorrect-docs-on-platform-1448372605209 (pull request #180) Correct incorrect docs on `platform`. Affected #: 1 file diff -r 569f3abbc262c7ec203d9a2e6bd38a14f13d410b -r e9569646da4fc7b0da514c10857a45ca79872007 doc/config-v2.txt --- a/doc/config-v2.txt +++ b/doc/config-v2.txt @@ -143,7 +143,7 @@ A testenv can define a new ``platform`` setting. If its value is not contained in the string obtained from calling -``platform.platform()`` the environment will be skipped. +``sys.platform`` the environment will be skipped. Expanding the ``envlist`` setting ---------------------------------------------------------- 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. From commits-noreply at bitbucket.org Wed Nov 25 06:27:50 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 25 Nov 2015 11:27:50 -0000 Subject: [Pytest-commit] commit/tox: 2 new changesets Message-ID: <20151125112750.9168.61858@celery-worker-101.ash1.bb-inf.net> 2 new commits in tox: https://bitbucket.org/hpk42/tox/commits/85fa8b0d60bc/ Changeset: 85fa8b0d60bc Branch: ionelmc/correct-incorrect-docs-on-platform-1448372605209 User: ionelmc Date: 2015-11-24 13:43:24+00:00 Summary: Correct incorrect docs on `platform`. Affected #: 1 file diff -r 569f3abbc262c7ec203d9a2e6bd38a14f13d410b -r 85fa8b0d60bcf1ea1ff2a1739e37c2438f34982e doc/config-v2.txt --- a/doc/config-v2.txt +++ b/doc/config-v2.txt @@ -143,7 +143,7 @@ A testenv can define a new ``platform`` setting. If its value is not contained in the string obtained from calling -``platform.platform()`` the environment will be skipped. +``sys.platform`` the environment will be skipped. Expanding the ``envlist`` setting ---------------------------------------------------------- https://bitbucket.org/hpk42/tox/commits/e9569646da4f/ Changeset: e9569646da4f User: hpk42 Date: 2015-11-25 11:27:48+00:00 Summary: Merged in ionelmc/tox-1/ionelmc/correct-incorrect-docs-on-platform-1448372605209 (pull request #180) Correct incorrect docs on `platform`. Affected #: 1 file diff -r 569f3abbc262c7ec203d9a2e6bd38a14f13d410b -r e9569646da4fc7b0da514c10857a45ca79872007 doc/config-v2.txt --- a/doc/config-v2.txt +++ b/doc/config-v2.txt @@ -143,7 +143,7 @@ A testenv can define a new ``platform`` setting. If its value is not contained in the string obtained from calling -``platform.platform()`` the environment will be skipped. +``sys.platform`` the environment will be skipped. Expanding the ``envlist`` setting ---------------------------------------------------------- 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. From issues-reply at bitbucket.org Wed Nov 25 07:57:56 2015 From: issues-reply at bitbucket.org (Daniel Hahler) Date: Wed, 25 Nov 2015 12:57:56 -0000 Subject: [Pytest-commit] Issue #290: Display exit code with InvocationErrors (hpk42/tox) Message-ID: <20151125125756.21792.38559@celery-worker-101.ash1.bb-inf.net> New issue 290: Display exit code with InvocationErrors https://bitbucket.org/hpk42/tox/issues/290/display-exit-code-with-invocationerrors Daniel Hahler: When a command fails, you currently only get `ERROR: InvocationError: '/usr/bin/false'`, but the exitcode itself is useful/important, e.g. with py.test using 5 for "no tests collected". The following patch would provide that, by using a custom `__str__` method for InvocationError - but it does not handle the case where that might be missing (not all instances / calls to it provide it). Maybe a custom `__init__` should be used to set the arguments as properties explicitly, and then use them?! ``` diff -r e9569646da4f tox/__init__.py --- a/tox/__init__.py Wed Nov 25 12:27:48 2015 +0100 +++ b/tox/__init__.py Wed Nov 25 13:23:26 2015 +0100 @@ -17,6 +17,9 @@ "signals that an interpreter could not be found" class InvocationError(Error): """ an error while invoking a script. """ + def __str__(self): + return "%s: %s (exitcode %d)" % (self.__class__.__name__, + self.args[0], self.args[1]) class MissingFile(Error): """ an error while invoking a script. """ class MissingDirectory(Error): ``` This is related / similar to https://bitbucket.org/hpk42/tox/issues/192. From commits-noreply at bitbucket.org Thu Nov 26 09:44:54 2015 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 26 Nov 2015 14:44:54 -0000 Subject: [Pytest-commit] commit/tox: hpk42: fix issue252: allow environment names with special characters. Message-ID: <20151126144454.13058.80322@celery-worker-101.ash1.bb-inf.net> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/af8d3ca4a530/ Changeset: af8d3ca4a530 User: hpk42 Date: 2015-11-26 13:54:53+00:00 Summary: fix issue252: allow environment names with special characters. Thanks Julien Castets for initial PR and patience. Affected #: 5 files diff -r e9569646da4fc7b0da514c10857a45ca79872007 -r af8d3ca4a53065d29c08ceb276040cb3bf42843f CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,9 @@ - fix issue289: fix build_sphinx target, thanks Barry Warsaw. +- fix issue252: allow environment names with special characters. + Thanks Julien Castets for initial PR and patience. + 2.2.1 ----- diff -r e9569646da4fc7b0da514c10857a45ca79872007 -r af8d3ca4a53065d29c08ceb276040cb3bf42843f setup.py --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='2.3.0.dev1', + version='2.3.0.dev2', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r e9569646da4fc7b0da514c10857a45ca79872007 -r af8d3ca4a53065d29c08ceb276040cb3bf42843f tests/test_z_cmdline.py --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -301,6 +301,23 @@ ]) +def test_venv_special_chars_issue252(cmd, initproj): + initproj("pkg123-0.7", filedefs={ + 'tests': {'test_hello.py': "def test_hello(): pass"}, + 'tox.ini': ''' + [tox] + envlist = special&&1 + [testenv:special&&1] + changedir=tests + ''' + }) + result = cmd.run("tox", ) + assert result.ret == 0 + result.stdout.fnmatch_lines([ + "*installed*pkg123*" + ]) + + def test_unknown_environment(cmd, initproj): initproj("env123-0.7", filedefs={ 'tox.ini': '' diff -r e9569646da4fc7b0da514c10857a45ca79872007 -r af8d3ca4a53065d29c08ceb276040cb3bf42843f tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.3.0.dev1' +__version__ = '2.3.0.dev2' from .hookspecs import hookspec, hookimpl # noqa diff -r e9569646da4fc7b0da514c10857a45ca79872007 -r af8d3ca4a53065d29c08ceb276040cb3bf42843f tox/session.py --- a/tox/session.py +++ b/tox/session.py @@ -533,11 +533,11 @@ action = self.newaction(venv, "envreport") with action: pip = venv.getcommandpath("pip") - # we can't really call internal helpers here easily :/ - # output = venv._pcall([str(pip), "freeze"], - # cwd=self.config.toxinidir, - # action=action) - output = py.process.cmdexec("%s freeze" % (pip)) + output = venv._pcall([str(pip), "freeze"], + cwd=self.config.toxinidir, + action=action) + # the output contains a mime-header, skip it + output = output.split("\n\n")[-1] packages = output.strip().split("\n") action.setactivity("installed", ",".join(packages)) envlog = self.resultlog.get_envlog(venv.name) 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. From issues-reply at bitbucket.org Thu Nov 26 17:30:55 2015 From: issues-reply at bitbucket.org (Feuermurmel) Date: Thu, 26 Nov 2015 22:30:55 -0000 Subject: [Pytest-commit] Issue #291: tox fails if path to project dir contains non-ASCII characters (hpk42/tox) Message-ID: <20151126223055.34749.89223@celery-worker-101.ash1.bb-inf.net> New issue 291: tox fails if path to project dir contains non-ASCII characters https://bitbucket.org/hpk42/tox/issues/291/tox-fails-if-path-to-project-dir-contains Feuermurmel: To test, I create a trivial `setup.py` ? import setuptools setuptools.setup() ? and an equally trivial `tox.ini`: [tox] envlist = py34 Running `tox` produces the following error: ``` michi ~/?$ tox GLOB sdist-make: /Users/michi/?/setup.py py34 create: /Users/michi/?/.tox/py34 ERROR: invocation failed (exit code 1), logfile: /Users/michi/?/.tox/py34/log/py34-0.log ERROR: actionid: py34 msg: getenv cmdargs: ['/opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4', '-m', 'virtualenv', '--python', '/opt/local/bin/python3.4', 'py34'] env: {'VIRTUAL_ENV': '/Users/michi/?/.tox/py34', 'PATH': '/Users/michi/?/.tox/py34/bin:/Users/michi/opt/bin/native/Darwin:/Users/michi/opt/bin:/opt/local/bin:/opt/local/sbin:/opt/local/libexec/gnubin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/local/bin', 'TMPDIR': '/var/folders/dy/tjw4y9qj127crhw6pzmcl_lh0000gq/T/', 'PYTHONHASHSEED': '274154285'} Using base prefix '/opt/local/Library/Frameworks/Python.framework/Versions/3.4' New python executable in py34/bin/python3.4 Also creating executable in py34/bin/python Installing setuptools, pip, wheel... ...Installing setuptools, pip, wheel...done. Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/virtualenv.py", line 2363, in main() File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/virtualenv.py", line 832, in main symlink=options.symlink) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/virtualenv.py", line 1004, in create_environment install_wheel(to_install, py_executable, search_dirs) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/virtualenv.py", line 969, in install_wheel 'PIP_NO_INDEX': '1' File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/virtualenv.py", line 906, in call_subprocess logger.notify('Complete output from command %s:' % cmd_desc) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/virtualenv.py", line 328, in notify self.log(self.NOTIFY, msg, *args, **kw) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/virtualenv.py", line 356, in log consumer.write(rendered+'\n') UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 44: ordinal not in range(128) Running virtualenv with interpreter /opt/local/bin/python3.4 ERROR: InvocationError: /opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 -m virtualenv --python /opt/local/bin/python3.4 py34 (see /Users/michi/?/.tox/py34/log/py34-0.log) ___________________________________ summary ____________________________________ ERROR: py34: InvocationError: /opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 -m virtualenv --python /opt/local/bin/python3.4 py34 (see /Users/michi/?/.tox/py34/log/py34-0.log) michi ~/?$ ``` Moving the project directory so its path only contains ASCII characters resolves the problem. This happens with tox 2.0.1 on OS X 10.9.5.