summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-06-19 11:38:21 +0200
committerGuido Günther <agx@sigxcpu.org>2013-06-19 14:55:44 +0200
commit11585033a6e26e2d376a441a58b8843e729c5733 (patch)
tree4cbf9c24c83c2ef6759a2ade6c31a2c863ac20f1
parentfe9f925c3cd4703ecf9409544d8692d677e32ff6 (diff)
GbpOptionParser: add test for 'filter' option handling
-rw-r--r--tests/test_Config.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_Config.py b/tests/test_Config.py
index 9fe7dd48..995d6196 100644
--- a/tests/test_Config.py
+++ b/tests/test_Config.py
@@ -80,3 +80,27 @@ def test_parser_fallback():
>>> parser.config['no']
'truth'
"""
+
+def test_filter():
+ """
+ The filter option should always parse as a list
+ >>> import os
+ >>> from gbp.config import GbpOptionParser
+ >>> parser = GbpOptionParser('bar')
+ >>> tmpdir = str(context.new_tmpdir('bar'))
+ >>> confname = os.path.join(tmpdir, 'gbp.conf')
+ >>> parser.config_files = [confname]
+ >>> f = file(confname, 'w')
+ >>> f.write('[bar]\\nfilter = asdf\\n')
+ >>> f.close()
+ >>> parser._parse_config_files()
+ >>> parser.config['filter']
+ ['asdf']
+ >>> f = file(confname, 'w')
+ >>> f.write("[bar]\\nfilter = ['this', 'is', 'a', 'list']\\n")
+ >>> f.close()
+ >>> parser._parse_config_files()
+ >>> parser.config['filter']
+ ['this', 'is', 'a', 'list']
+ """
+