diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/data/module.py | 1 | ||||
-rw-r--r-- | test/unittest_configuration.py | 45 | ||||
-rw-r--r-- | test/unittest_table.py | 1 | ||||
-rw-r--r-- | test/unittest_tree.py | 1 | ||||
-rw-r--r-- | test/unittest_ureports_html.py | 1 | ||||
-rw-r--r-- | test/unittest_ureports_text.py | 1 | ||||
-rw-r--r-- | test/utils.py | 1 |
7 files changed, 43 insertions, 8 deletions
diff --git a/test/data/module.py b/test/data/module.py index 9b85430..4e1abce 100644 --- a/test/data/module.py +++ b/test/data/module.py @@ -2,7 +2,6 @@ """test module for astng """ -__revision__ = '$Id: module.py,v 1.9 2003-11-24 13:40:26 syt Exp $' from logilab.common import modutils, Execute as spawn from logilab.common.astutils import * diff --git a/test/unittest_configuration.py b/test/unittest_configuration.py index a8e3c0f..edcb5db 100644 --- a/test/unittest_configuration.py +++ b/test/unittest_configuration.py @@ -1,4 +1,4 @@ -# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of logilab-common. @@ -25,7 +25,7 @@ from sys import version_info from logilab.common.testlib import TestCase, unittest_main from logilab.common.optik_ext import OptionValueError -from logilab.common.configuration import Configuration, \ +from logilab.common.configuration import Configuration, OptionError, \ OptionsManagerMixIn, OptionsProviderMixIn, Method, read_old_config, \ merge_options @@ -47,6 +47,8 @@ OPTIONS = [('dothis', {'type':'yn', 'action': 'store', 'default': True, 'metavar ('diffgroup', {'type':'string', 'default':'pouet', 'metavar': '<key=val>', 'group': 'agroup'}), + ('reset-value', {'type': 'string', 'metavar': '<string>', 'short': 'r', + 'dest':'value'}), ] @@ -149,6 +151,38 @@ diffgroup=zou finally: os.remove(file) + def test_option_order(self): + """ Check that options are taken into account in the command line order + and not in the order they are defined in the Configuration object. + """ + file = tempfile.mktemp() + stream = open(file, 'w') + try: + stream.write("""[Test] +reset-value=toto +value=tata +""") + stream.close() + self.cfg.load_file_configuration(file) + finally: + os.remove(file) + self.assertEqual(self.cfg['value'], 'tata') + + def test_unsupported_options(self): + file = tempfile.mktemp() + stream = open(file, 'w') + try: + stream.write("""[Test] +whatever=toto +value=tata +""") + stream.close() + self.cfg.load_file_configuration(file) + finally: + os.remove(file) + self.assertEqual(self.cfg['value'], 'tata') + self.assertRaises(OptionError, self.cfg.__getitem__, 'whatever') + def test_generate_config(self): stream = StringIO() self.cfg.generate_config(stream) @@ -170,6 +204,8 @@ multiple-choice=yo,ye named=key:val +#reset-value= + [AGROUP] @@ -197,6 +233,8 @@ multiple-choice=yo,ye named=key:val +reset-value=' ' + [AGROUP] @@ -251,6 +289,7 @@ Options: --choice=<yo|ye> --multiple-choice=<yo|ye> --named=<key=val> + -r <string>, --reset-value=<string> Agroup: --diffgroup=<key=val> @@ -309,6 +348,8 @@ multiple-choice=yo,ye named=key:val +reset-value=' ' + [AGROUP] diff --git a/test/unittest_table.py b/test/unittest_table.py index d2db8b7..7c58d69 100644 --- a/test/unittest_table.py +++ b/test/unittest_table.py @@ -19,7 +19,6 @@ Unittests for table management """ -__revision__ = '$Id: unittest_table.py,v 1.13 2006-04-09 22:30:53 nico Exp $' import sys import os diff --git a/test/unittest_tree.py b/test/unittest_tree.py index 8e7f4bd..fb8e303 100644 --- a/test/unittest_tree.py +++ b/test/unittest_tree.py @@ -19,7 +19,6 @@ unit tests for module logilab.common.tree squeleton generated by /home/syt/bin/py2tests on Jan 20 at 10:43:25 """ -__revision__ = "$Id: unittest_tree.py,v 1.9 2005-09-07 23:44:02 nico Exp $" from logilab.common.testlib import TestCase, unittest_main from logilab.common.tree import * diff --git a/test/unittest_ureports_html.py b/test/unittest_ureports_html.py index c849c4f..2298eec 100644 --- a/test/unittest_ureports_html.py +++ b/test/unittest_ureports_html.py @@ -18,7 +18,6 @@ '''unit tests for ureports.html_writer ''' -__revision__ = "$Id: unittest_ureports_html.py,v 1.3 2005-05-27 12:27:08 syt Exp $" from utils import WriterTC from logilab.common.testlib import TestCase, unittest_main diff --git a/test/unittest_ureports_text.py b/test/unittest_ureports_text.py index 25a2194..dd39dd8 100644 --- a/test/unittest_ureports_text.py +++ b/test/unittest_ureports_text.py @@ -18,7 +18,6 @@ '''unit tests for ureports.text_writer ''' -__revision__ = "$Id: unittest_ureports_text.py,v 1.4 2005-05-27 12:27:08 syt Exp $" from utils import WriterTC from logilab.common.testlib import TestCase, unittest_main diff --git a/test/utils.py b/test/utils.py index 957d7eb..f54c179 100644 --- a/test/utils.py +++ b/test/utils.py @@ -18,7 +18,6 @@ '''unit tests utilities for ureports ''' -__revision__ = "$Id: utils.py,v 1.3 2005-05-27 12:27:08 syt Exp $" from cStringIO import StringIO from logilab.common.ureports.nodes import * |