2 new commits in tox: https://bitbucket.org/hpk42/tox/commits/66b0272bf19e/ Changeset: 66b0272bf19e Branch: issue302 User: andrew_pashkin Date: 2016-09-09 11:45:54+00:00 Summary: Make substitution engine ignore factor arrays, fix #302
The fix assumes, that the bug was that the substitution engine - tox.config.Replacer, while recursvely replacing references to actual values, treated factor arrays (like {py27,py34}) as references, that are needed to be replaced, which they are not. The patch simply amends regex which is used by Replacer to recognize references, to ignore factor arrays. And factor arrays assumed to be values, enclosed in curly braces, that contain at least one comma. Affected #: 2 files diff -r 19a03d4e500ba859631bce6f6999de09b1a48cde -r 66b0272bf19e4098042e12237824aecbb387be4b tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1154,20 +1154,32 @@ argv = conf.commands assert argv[0] == ["cmd1", "hello"] - def test_take_dependencies_from_other_testenv(self, newconfig): + @pytest.mark.parametrize('envlist, deps', [ + (['py27'], ('pytest', 'pytest-cov')), + (['py27', 'py34'], ('pytest', 'py{27,34}: pytest-cov')), + ]) + def test_take_dependencies_from_other_testenv( + self, + newconfig, + envlist, + deps + ): inisource = """ + [tox] + envlist = {envlist} [testenv] - deps= - pytest - pytest-cov + deps={deps} [testenv:py27] deps= - {[testenv]deps} + {{[testenv]deps}} fun - """ + """.format( + envlist=','.join(envlist), + deps='\n' + '\n'.join([' ' * 17 + d for d in deps]) + ) conf = newconfig([], inisource).envconfigs['py27'] packages = [dep.name for dep in conf.deps] - assert packages == ['pytest', 'pytest-cov', 'fun'] + assert packages == list(deps) + ['fun'] def test_take_dependencies_from_other_section(self, newconfig): inisource = """ diff -r 19a03d4e500ba859631bce6f6999de09b1a48cde -r 66b0272bf19e4098042e12237824aecbb387be4b tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -1017,7 +1017,7 @@ r''' (?<!\\)[{] (?:(?P<sub_type>[^[:{}]+):)? # optional sub_type for special rules - (?P<substitution_value>[^{}]*) # substitution key + (?P<substitution_value>[^,{}]*) # substitution key [}] ''', re.VERBOSE) https://bitbucket.org/hpk42/tox/commits/9071df77a7fd/ Changeset: 9071df77a7fd User: hpk42 Date: 2016-09-14 09:12:15+00:00 Summary: Merged in andrew_pashkin/tox/issue302 (pull request #207) Make substitution engine ignore factor arrays, fix #302 Affected #: 2 files diff -r 19a03d4e500ba859631bce6f6999de09b1a48cde -r 9071df77a7fd3eee9464addc870be88c12b54fe6 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1154,20 +1154,32 @@ argv = conf.commands assert argv[0] == ["cmd1", "hello"] - def test_take_dependencies_from_other_testenv(self, newconfig): + @pytest.mark.parametrize('envlist, deps', [ + (['py27'], ('pytest', 'pytest-cov')), + (['py27', 'py34'], ('pytest', 'py{27,34}: pytest-cov')), + ]) + def test_take_dependencies_from_other_testenv( + self, + newconfig, + envlist, + deps + ): inisource = """ + [tox] + envlist = {envlist} [testenv] - deps= - pytest - pytest-cov + deps={deps} [testenv:py27] deps= - {[testenv]deps} + {{[testenv]deps}} fun - """ + """.format( + envlist=','.join(envlist), + deps='\n' + '\n'.join([' ' * 17 + d for d in deps]) + ) conf = newconfig([], inisource).envconfigs['py27'] packages = [dep.name for dep in conf.deps] - assert packages == ['pytest', 'pytest-cov', 'fun'] + assert packages == list(deps) + ['fun'] def test_take_dependencies_from_other_section(self, newconfig): inisource = """ diff -r 19a03d4e500ba859631bce6f6999de09b1a48cde -r 9071df77a7fd3eee9464addc870be88c12b54fe6 tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -1017,7 +1017,7 @@ r''' (?<!\\)[{] (?:(?P<sub_type>[^[:{}]+):)? # optional sub_type for special rules - (?P<substitution_value>[^{}]*) # substitution key + (?P<substitution_value>[^,{}]*) # substitution key [}] ''', re.VERBOSE) Repository URL: https://bitbucket.org/hpk42/tox/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit