summaryrefslogtreecommitdiff
path: root/tests
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
parentcaff99cb63b4837eb91d5ee312c2c36663c08c88 (diff)
downloadgit-buildpackage-fe9f925c3cd4703ecf9409544d8692d677e32ff6.tar.gz
git-buildpackage-fe9f925c3cd4703ecf9409544d8692d677e32ff6.tar.bz2
git-buildpackage-fe9f925c3cd4703ecf9409544d8692d677e32ff6.zip
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')
-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 3f19dc58..9fe7dd48 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'
+ """