summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2015-11-20 13:36:09 +0100
committerholger krekel <holger@merlinux.eu>2015-11-20 13:36:09 +0100
commit467347bf893460709e5186cd2ecbe44066027171 (patch)
tree9b36c1a7abdf570324f22a835f4e4a9a2c48b10e
parent616b85457ba1781c9b5e33ff17964eb03a7a404b (diff)
parentf8b7e6cce49c012885f9d15e05751c8dc85359e7 (diff)
downloadtox-467347bf893460709e5186cd2ecbe44066027171.tar.gz
Merged in dstanek/tox/bug_181 (pull request #174)
Fixes bug 181; allow # in commands
-rw-r--r--tests/test_config.py28
-rw-r--r--tox/config.py4
2 files changed, 24 insertions, 8 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 61047c1..a9a97b8 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -459,7 +459,7 @@ class TestIniParser:
config = newconfig("""
[section]
key2=
- cmd1 {item1} \ # a comment
+ cmd1 {item1} \
{item2}
""")
reader = SectionReader("section", config._cfg)
@@ -474,12 +474,32 @@ class TestIniParser:
config = newconfig("""
[section]
key1=
- cmd1 'with space' \ # a comment
- 'after the comment'
+ cmd1 'part one' \
+ 'part two'
""")
reader = SectionReader("section", config._cfg)
x = reader.getargvlist("key1")
- assert x == [["cmd1", "with space", "after the comment"]]
+ assert x == [["cmd1", "part one", "part two"]]
+
+ def test_argvlist_comment_after_command(self, tmpdir, newconfig):
+ config = newconfig("""
+ [section]
+ key1=
+ cmd1 --flag # run the flag on the command
+ """)
+ reader = SectionReader("section", config._cfg)
+ x = reader.getargvlist("key1")
+ assert x == [["cmd1", "--flag"]]
+
+ def test_argvlist_command_contains_hash(self, tmpdir, newconfig):
+ config = newconfig("""
+ [section]
+ key1=
+ cmd1 --re "use the # symbol for an arg"
+ """)
+ reader = SectionReader("section", config._cfg)
+ x = reader.getargvlist("key1")
+ assert x == [["cmd1", "--re", "use the # symbol for an arg"]]
def test_argvlist_positional_substitution(self, tmpdir, newconfig):
config = newconfig("""
diff --git a/tox/config.py b/tox/config.py
index 9f5aae3..2caeb1a 100644
--- a/tox/config.py
+++ b/tox/config.py
@@ -1010,9 +1010,6 @@ class _ArgvlistReader:
current_command = ""
for line in value.splitlines():
line = line.rstrip()
- i = line.find("#")
- if i != -1:
- line = line[:i].rstrip()
if not line:
continue
if line.endswith("\\"):
@@ -1064,7 +1061,6 @@ class _ArgvlistReader:
shlexer = shlex.shlex(newcommand, posix=True)
shlexer.whitespace_split = True
shlexer.escape = ''
- shlexer.commenters = ''
argv = list(shlexer)
return argv