summaryrefslogtreecommitdiff
path: root/tests/test_Config.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-06-19 00:25:53 +0200
committerGuido Günther <agx@sigxcpu.org>2013-06-19 14:55:44 +0200
commitfe9f925c3cd4703ecf9409544d8692d677e32ff6 (patch)
tree4faaba554967959e64ca2489715a775975cfbec5 /tests/test_Config.py
parentcaff99cb63b4837eb91d5ee312c2c36663c08c88 (diff)
GbpOptionParser: Make sure we parse the old config sections
For backward compatibility between {gbp,git}-<subcommand> and "gbp <subcommand>" make sure we parse the former sections if using the later.
Diffstat (limited to 'tests/test_Config.py')
-rw-r--r--tests/test_Config.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_Config.py b/tests/test_Config.py
index 3f19dc5..9fe7dd4 100644
--- a/tests/test_Config.py
+++ b/tests/test_Config.py
@@ -59,3 +59,24 @@ def test_tristate():
>>> options.color
auto
"""
+
+def test_parser_fallback():
+ """
+ Make sure we also parse git-<subcommands> sections if
+ gbp <subcommand> was used.
+
+ >>> import os
+ >>> from gbp.config import GbpOptionParser
+ >>> parser = GbpOptionParser('foo')
+ >>> tmpdir = str(context.new_tmpdir('foo'))
+ >>> confname = os.path.join(tmpdir, 'gbp.conf')
+ >>> parser.config_files = [confname]
+ >>> f = file(confname, 'w')
+ >>> f.write('[foo]\\nthere = is\\n[git-foo]\\nno = truth\\n')
+ >>> f.close()
+ >>> parser._parse_config_files()
+ >>> parser.config['there']
+ 'is'
+ >>> parser.config['no']
+ 'truth'
+ """