[Pytest-commit] commit/tox: hpk42: Merged in msabramo/tox/allow_backslash_escape_curly_braces_msabramo_2 (pull request #93)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Oct 14 10:10:22 CEST 2014
1 new commit in tox:
https://bitbucket.org/hpk42/tox/commits/2c1f0d218f7c/
Changeset: 2c1f0d218f7c
User: hpk42
Date: 2014-10-14 08:10:18+00:00
Summary: Merged in msabramo/tox/allow_backslash_escape_curly_braces_msabramo_2 (pull request #93)
Allow backslashing curly braces to prevent expansion
Affected #: 2 files
diff -r b50e77c3d2ca888b609f540176422d79804fd9ae -r 2c1f0d218f7c5c4f3994aa1b7f82aedb7680d3e9 tests/test_config.py
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -706,6 +706,23 @@
assert argv[0] == ["cmd1", "[hello]", "world"]
assert argv[1] == ["cmd1", "brave", "new", "world"]
+ def test_posargs_backslashed_or_quoted(self, tmpdir, newconfig):
+ inisource = """
+ [testenv:py24]
+ commands =
+ echo "\{posargs\}" = {posargs}
+ echo "posargs = " "{posargs}"
+ """
+ conf = newconfig([], inisource).envconfigs['py24']
+ argv = conf.commands
+ assert argv[0] == ['echo', '\\{posargs\\}', '=']
+ assert argv[1] == ['echo', 'posargs =']
+
+ conf = newconfig(['dog', 'cat'], inisource).envconfigs['py24']
+ argv = conf.commands
+ assert argv[0] == ['echo', '\\{posargs\\}', '=', 'dog', 'cat']
+ assert argv[1] == ['echo', 'posargs =', 'dog', 'cat']
+
def test_rewrite_posargs(self, tmpdir, newconfig):
inisource = """
[testenv:py24]
diff -r b50e77c3d2ca888b609f540176422d79804fd9ae -r 2c1f0d218f7c5c4f3994aa1b7f82aedb7680d3e9 tox/_config.py
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -484,8 +484,8 @@
self.url = url
RE_ITEM_REF = re.compile(
- '''
- [{]
+ r'''
+ (?<!\\)[{]
(?:(?P<sub_type>[^[:{}]+):)? # optional sub_type for special rules
(?P<substitution_value>[^{}]*) # substitution key
[}]
@@ -752,7 +752,7 @@
def word_has_ended():
return ((cur_char in string.whitespace and ps.word and
ps.word[-1] not in string.whitespace) or
- (cur_char == '{' and ps.depth == 0) or
+ (cur_char == '{' and ps.depth == 0 and not ps.word.endswith('\\')) or
(ps.depth == 0 and ps.word and ps.word[-1] == '}') or
(cur_char not in string.whitespace and ps.word and
ps.word.strip() == ''))
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.
More information about the pytest-commit
mailing list