From fc73a70a79ec5f5ce8bdba70dd73bd61555ea277 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Tue, 10 May 2016 13:16:44 +1000 Subject: Add test for issue #307 This adds a test to address the second example in issue #307, the first example is already addressed. Closes issue #307 --- tests/test_config.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index 372cd4f..471e784 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -288,6 +288,20 @@ class TestIniParserAgainstCommandsKey: x = reader.getargvlist("commands") assert x == [['thing', 'argpos', 'arg2']] + def test_command_section_and_posargs_substitution(self, newconfig): + """Ensure subsitition from other section with posargs succeeds""" + config = newconfig(""" + [section] + key = thing arg1 + [testenv] + commands = + {[section]key} {posargs} endarg + """) + reader = SectionReader("testenv", config._cfg) + reader.addsubstitutions([r"argpos"]) + x = reader.getargvlist("commands") + assert x == [['thing', 'arg1', 'argpos', 'endarg']] + def test_command_env_substitution(self, newconfig): """Ensure referenced {env:key:default} values are substituted correctly.""" config = newconfig(""" -- cgit v1.2.1