[Pytest-commit] commit/tox: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Oct 14 10:10:22 CEST 2014


3 new commits in tox:

https://bitbucket.org/hpk42/tox/commits/9d7345ef4b2b/
Changeset:   9d7345ef4b2b
Branch:      allow_backslash_escape_curly_braces_msabramo_2
User:        Marc Abramowitz
Date:        2014-04-03 22:45:55+00:00
Summary:     Allow backslashing curly braces to prevent expansion

e.g.: commands=echo \{posargs\} = {posargs}
Affected #:  1 file

diff -r 0c390972b576b50dc0e78bd5cbb8e6a164f15f8b -r 9d7345ef4b2be4f12a30a887fcda30c7b268c245 tox/_config.py
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -451,8 +451,8 @@
         self.url = url
 
 RE_ITEM_REF = re.compile(
-    '''
-    [{]
+    r'''
+    (?<!\\)[{]
     (?:(?P<sub_type>[^[:{}]+):)?    # optional sub_type for special rules
     (?P<substitution_value>[^{}]*)  # substitution key
     [}]
@@ -686,7 +686,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() == ''))


https://bitbucket.org/hpk42/tox/commits/b1e0902bf31f/
Changeset:   b1e0902bf31f
Branch:      allow_backslash_escape_curly_braces_msabramo_2
User:        Marc Abramowitz
Date:        2014-05-12 05:44:09+00:00
Summary:     Add test_posargs_backslashed_or_quoted
Affected #:  1 file

diff -r 9d7345ef4b2be4f12a30a887fcda30c7b268c245 -r b1e0902bf31fe4c706e8cf5339858aea65b32c9f tests/test_config.py
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -663,6 +663,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]


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