diff options
author | Julien Jehannet <julien.jehannet@logilab.fr> | 2010-11-17 19:22:52 +0100 |
---|---|---|
committer | Julien Jehannet <julien.jehannet@logilab.fr> | 2010-11-17 19:22:52 +0100 |
commit | b533d48c3d606549772aeb9bc7697e13974ef023 (patch) | |
tree | f1a96134dd7f9409f3f0d0adbbc811ed52a76e46 | |
parent | cb7f88527dc1ed478b45e52307e0b83718cfcb5d (diff) | |
download | logilab-common-b533d48c3d606549772aeb9bc7697e13974ef023.tar.gz |
pytest: make test suite compatible with 2.7
-rw-r--r-- | pytest.py | 5 | ||||
-rw-r--r-- | testlib.py | 5 |
2 files changed, 6 insertions, 4 deletions
@@ -118,11 +118,12 @@ import types from logilab.common.fileutils import abspath_listdir from logilab.common import testlib, STD_BLACKLIST +# use the same unittest module as testlib from logilab.common.testlib import unittest import doctest -# use the same unittest module as testlib -if sys.version_info < (3, 2): +import unittest as unittest_legacy +if not getattr(unittest_legacy, "__package__", None): try: import unittest2.suite as unittest_suite except ImportError: @@ -57,7 +57,8 @@ from ConfigParser import ConfigParser from logilab.common.deprecation import deprecated from itertools import dropwhile -if sys.version_info < (3, 2): +import unittest as unittest_legacy +if not getattr(unittest_legacy, "__package__", None): try: import unittest2 as unittest from unittest2 import SkipTest @@ -969,7 +970,7 @@ succeeded test into", osp.join(os.getcwd(), FILE_RESTART) from xml.parsers.expat import ExpatError try: parse(data) - except ExpatError, ex: + except (ExpatError, ParseError), ex: if msg is None: if hasattr(data, 'readlines'): #file like object data.seek(0) |