summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRémi Cardona <remi.cardona@logilab.fr>2015-07-23 18:31:34 +0200
committerRémi Cardona <remi.cardona@logilab.fr>2015-07-23 18:31:34 +0200
commit58da013132ef0c87fb4bed82a0ea033efe9adae7 (patch)
tree48ced772ac94527a75023c610e550b39c36d1622 /test
parent93fe2e0e7e42f4cdf4e977cca8df14431c63e68b (diff)
downloadlogilab-common-58da013132ef0c87fb4bed82a0ea033efe9adae7.tar.gz
[configuration] Have a stable order for sections (closes #298658)
Useful when generating a default configuration file, like pylint's. Fix provided by Craig Hobbs <craigahobbs@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/unittest_configuration.py33
1 files changed, 30 insertions, 3 deletions
diff --git a/test/unittest_configuration.py b/test/unittest_configuration.py
index 378b536..f72f2e1 100644
--- a/test/unittest_configuration.py
+++ b/test/unittest_configuration.py
@@ -51,6 +51,8 @@ OPTIONS = [('dothis', {'type':'yn', 'action': 'store', 'default': True, 'metavar
('reset-value', {'type': 'string', 'metavar': '<string>', 'short': 'r',
'dest':'value'}),
+ ('opt-b-1', {'type': 'string', 'metavar': '<string>', 'group': 'bgroup'}),
+ ('opt-b-2', {'type': 'string', 'metavar': '<string>', 'group': 'bgroup'}),
]
class MyConfiguration(Configuration):
@@ -210,7 +212,14 @@ named=key:val
[AGROUP]
-diffgroup=pouet""")
+diffgroup=pouet
+
+
+[BGROUP]
+
+#opt-b-1=
+
+#opt-b-2=""")
def test_generate_config_with_space_string(self):
self.cfg['value'] = ' '
@@ -239,7 +248,14 @@ reset-value=' '
[AGROUP]
-diffgroup=pouet""")
+diffgroup=pouet
+
+
+[BGROUP]
+
+#opt-b-1=
+
+#opt-b-2=""")
def test_roundtrip(self):
@@ -295,6 +311,10 @@ Options:
Agroup:
--diffgroup=<key=val>
+ Bgroup:
+ --opt-b-1=<string>
+ --opt-b-2=<string>
+
Bonus:
a nice additional help"""
if version_info < (2, 5):
@@ -356,7 +376,14 @@ reset-value=' '
[AGROUP]
-diffgroup=pouet""")
+diffgroup=pouet
+
+
+[BGROUP]
+
+#opt-b-1=
+
+#opt-b-2=""")
class Linter(OptionsManagerMixIn, OptionsProviderMixIn):
options = (