summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2014-10-21 16:38:21 +0200
committerholger krekel <holger@merlinux.eu>2014-10-21 16:38:21 +0200
commit6067b1fda166dcaf757ca084b8213be52e854ea9 (patch)
tree1d5094d036826168ee1fdcbbfda12b0c96970ca7
parentc5f1982a9d2dabf6f7eeae0e795d74523ad253eb (diff)
parent1d7b2c568c940a1fc160b7e622622b33db9f4ee5 (diff)
downloadtox-6067b1fda166dcaf757ca084b8213be52e854ea9.tar.gz
Merged in carljm/tox (pull request #123)
Add --pre and testenv pip_pre options, no --pre by default.
-rw-r--r--tests/test_config.py32
-rw-r--r--tox/_config.py10
2 files changed, 37 insertions, 5 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 79e9a74..18ad222 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -725,6 +725,23 @@ class TestConfigTestEnv:
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]
@@ -929,6 +946,21 @@ class TestConfigTestEnv:
assert configs["py27"].setenv["X"] == "1"
assert "X" not in configs["py26"].setenv
+ def test_period_in_factor(self, newconfig):
+ inisource="""
+ [tox]
+ envlist = py27-{django1.6,django1.7}
+
+ [testenv]
+ deps =
+ django1.6: Django==1.6
+ django1.7: Django==1.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"]
+
class TestGlobalOptions:
def test_notest(self, newconfig):
diff --git a/tox/_config.py b/tox/_config.py
index ee450d8..ceae6b9 100644
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -308,7 +308,7 @@ class parseini:
factors = set()
if section in self._cfg:
for _, value in self._cfg[section].items():
- exprs = re.findall(r'^([\w{},-]+)\:\s+', value, re.M)
+ exprs = re.findall(r'^([\w{}\.,-]+)\:\s+', value, re.M)
factors.update(*mapcat(_split_factor_expr, exprs))
return factors
@@ -489,8 +489,8 @@ class IndexServerConfig:
self.url = url
RE_ITEM_REF = re.compile(
- '''
- [{]
+ r'''
+ (?<!\\)[{]
(?:(?P<sub_type>[^[:{}]+):)? # optional sub_type for special rules
(?P<substitution_value>[^{}]*) # substitution key
[}]
@@ -647,7 +647,7 @@ class IniReader:
def _apply_factors(self, s):
def factor_line(line):
- m = re.search(r'^([\w{},-]+)\:\s+(.+)', line)
+ m = re.search(r'^([\w{}\.,-]+)\:\s+(.+)', line)
if not m:
return line
@@ -757,7 +757,7 @@ class CommandParser(object):
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() == ''))