summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachi King <nakato@nakato.io>2016-02-11 15:54:23 +1100
committerSachi King <nakato@nakato.io>2016-02-11 15:54:23 +1100
commit89c84ff3282e014af29c5edf78ae751bf05f34b4 (patch)
tree01442a9c3a1d5d644a1738029bd7f345187c01ea
parentb370f49189add61626f1aad5ed61eb9023daeb84 (diff)
downloadtox-89c84ff3282e014af29c5edf78ae751bf05f34b4.tar.gz
Fix section substitution with {posargs}
Use crossonly to stop substitution immediately after the section is substituted, the values run through substitution again afterwards, and this will clean off {posargs} and any other substitutions that need to be made.
-rw-r--r--tests/test_config.py2
-rw-r--r--tox/config.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index f669726..372cd4f 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -286,7 +286,7 @@ class TestIniParserAgainstCommandsKey:
reader = SectionReader("testenv", config._cfg)
reader.addsubstitutions([r"argpos"])
x = reader.getargvlist("commands")
- assert x == [['thing', 'argpos' 'arg2']]
+ assert x == [['thing', 'argpos', 'arg2']]
def test_command_env_substitution(self, newconfig):
"""Ensure referenced {env:key:default} values are substituted correctly."""
diff --git a/tox/config.py b/tox/config.py
index 079dff3..67454bc 100644
--- a/tox/config.py
+++ b/tox/config.py
@@ -1094,7 +1094,7 @@ class _ArgvlistReader:
current_command += line
if is_section_substitution(current_command):
- replaced = reader._replace(current_command)
+ replaced = reader._replace(current_command, crossonly=True)
commands.extend(cls.getargvlist(reader, replaced))
else:
commands.append(cls.processcommand(reader, current_command))