summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2017-05-11 17:05:52 +0200
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2017-05-11 17:05:52 +0200
commit372e76ae28e3dc659e606dd38237a04f0ccd8066 (patch)
tree233bbd868639dd32529424f5803c3e40bb2c34a7 /test
parentefe27c4a0250b0ac3726e64813e5ff157e51e814 (diff)
downloadlogilab-common-372e76ae28e3dc659e606dd38237a04f0ccd8066.tar.gz
[configuration] fix registration of multiple groups at once
The "options" iteration variable hid the original function parameters, therefore only the options of the last group were registered. Rename the iteration variable and everything's fine.
Diffstat (limited to 'test')
-rw-r--r--test/unittest_configuration.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unittest_configuration.py b/test/unittest_configuration.py
index f59a0e0..ea7cdca 100644
--- a/test/unittest_configuration.py
+++ b/test/unittest_configuration.py
@@ -469,6 +469,22 @@ class RegrTC(TestCase):
self.linter.load_command_line_configuration([])
self.assertEqual(self.linter.config.profile, False)
+ def test_register_options_multiple_groups(self):
+ """ensure multiple option groups can be registered at once"""
+ config = Configuration()
+ self.assertEqual(config.options, ())
+ new_options = (
+ ('option1', {'type': 'string', 'help': '',
+ 'group': 'g1', 'level': 2}),
+ ('option2', {'type': 'string', 'help': '',
+ 'group': 'g1', 'level': 2}),
+ ('option3', {'type': 'string', 'help': '',
+ 'group': 'g2', 'level': 2}),
+ )
+ config.register_options(new_options)
+ self.assertEqual(config.options, new_options)
+
+
class MergeTC(TestCase):
def test_merge1(self):