summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2016-02-11 18:05:32 +0100
committerholger krekel <holger@merlinux.eu>2016-02-11 18:05:32 +0100
commitf9bb798ed6b43504effea5a590106c9e8f7caafe (patch)
treebccda0f33ef05a8f970a171a9a63c9ae78eda19c
parent262863894f62e9d397f62963b956bfbe7bf6ce9e (diff)
parent89c84ff3282e014af29c5edf78ae751bf05f34b4 (diff)
downloadtox-f9bb798ed6b43504effea5a590106c9e8f7caafe.tar.gz
Merged in nakatoio/tox (pull request #189)
Fix section substitution with {posargs}
-rw-r--r--tests/test_config.py14
-rw-r--r--tox/config.py2
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 6176641..372cd4f 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -274,6 +274,20 @@ class TestIniParserAgainstCommandsKey:
["echo", "cmd", "1", "2", "3", "4", "cmd", "2"],
]
+ def test_command_substitution_from_other_section_posargs(self, newconfig):
+ """Ensure subsitition from other section with posargs succeeds"""
+ config = newconfig("""
+ [section]
+ key = thing {posargs} arg2
+ [testenv]
+ commands =
+ {[section]key}
+ """)
+ reader = SectionReader("testenv", config._cfg)
+ reader.addsubstitutions([r"argpos"])
+ x = reader.getargvlist("commands")
+ assert x == [['thing', 'argpos', 'arg2']]
+
def test_command_env_substitution(self, newconfig):
"""Ensure referenced {env:key:default} values are substituted correctly."""
config = newconfig("""
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))