diff options
author | Julien Jehannet <julien.jehannet@logilab.fr> | 2010-06-18 12:30:16 +0200 |
---|---|---|
committer | Julien Jehannet <julien.jehannet@logilab.fr> | 2010-06-18 12:30:16 +0200 |
commit | 13825514749b3577d9c7df11a848c1ecbc0d1cba (patch) | |
tree | ebe9043d23e741b0f7c9bdf417803c2c1ab97b6d | |
parent | c5717df33caa321e32c64129c859ad4e90ab4687 (diff) | |
download | logilab-common-13825514749b3577d9c7df11a848c1ecbc0d1cba.tar.gz |
tests: fix some configuration tests (python2.4)
- catch Etree import error for 2.4
- update usage for python2.4 (Debian stable version)
-rw-r--r-- | test/unittest_configuration.py | 41 | ||||
-rw-r--r-- | testlib.py | 6 |
2 files changed, 16 insertions, 31 deletions
diff --git a/test/unittest_configuration.py b/test/unittest_configuration.py index 980b705..0210239 100644 --- a/test/unittest_configuration.py +++ b/test/unittest_configuration.py @@ -231,8 +231,7 @@ diffgroup=pouet # it is not unlikely some optik/optparse versions do print -v<string> # so accept both help = help.replace(' -v <string>, ', ' -v<string>, ') - if version_info >= (2, 5): - self.assertLinesEquals(help, """Usage: Just do it ! (tm) + USAGE = """Usage: Just do it ! (tm) Options: -h, --help show this help message and exit @@ -245,31 +244,17 @@ Options: --multiple-choice=<yo|ye> --named=<key=val> - Agroup: - --diffgroup=<key=val> +Agroup: + --diffgroup=<key=val> - Bonus: - a nice additional help -""", striplines=True) - elif version_info >= (2, 4): - self.assertLinesEquals(help, """usage: Just do it ! (tm) - -options: - -h, --help show this help message and exit - --dothis=<y or n> - -v<string>, --value=<string> - --multiple=<comma separated values> - you can also document the option [current: yop,yep] - --number=<int> boom [current: 2] - --choice=<yo|ye> - --multiple-choice=<yo|ye> - --named=<key=val> - - Bonus: - a nice additional help -""", striplines=True) - else: - self.assertLinesEquals(help, """usage: Just do it ! (tm) +Bonus: + a nice additional help +""" + if version_info < (2, 5): + # 'usage' header is not capitalized in this version + USAGE = USAGE.replace('Usage: ', 'usage: ') + elif version_info < (2, 4): + USAGE = """usage: Just do it ! (tm) options: -h, --help show this help message and exit @@ -284,7 +269,9 @@ options: Bonus: a nice additional help -""", striplines=True) +""" + + self.assertLinesEquals(help, USAGE, striplines=True) def test_manpage(self): @@ -1402,11 +1402,9 @@ succeeded test into", osp.join(os.getcwd(),FILE_RESTART) """ try: from xml.etree.ElementTree import fromstring - self._assertETXMLWellFormed(xml_string, fromstring, msg) except ImportError: - raise - stream = StringIO(xml_string) - self.assertXMLWellFormed(stream, msg) + from elementtree.ElementTree import fromstring + self._assertETXMLWellFormed(xml_string, fromstring, msg) def _assertETXMLWellFormed(self, data, parse, msg=None, context=2): """internal function used by /assertXML(String)?WellFormed/ functions |