From a5bc9b5aa5c78fee20311b2a65db64d1b45c9a98 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Mon, 13 Aug 2012 23:23:28 -0400 Subject: [PATCH] Disable tests when old versions of twisted are installed. Twisted 10.0 (on an older version of Ubuntu) doesn't seem to work with class decorators, even on python 2.6. This makes the tests fail with a TypeError: Traceback (most recent call last): File "tornado/test/import_test.py", line 59, in test_import_twisted import tornado.platform.twisted File "tornado/platform/twisted.py", line 108, in TornadoDelayedCall = implementer(IDelayedCall)(TornadoDelayedCall) File "/usr/lib/python2.6/dist-packages/zope/interface/declarations.py", line 496, in __call__ raise TypeError("Can't use implementer with classes. Use one of " TypeError: Can't use implementer with classes. Use one of the class-declaration functions instead. If we catch a typeerror while importing twisted, act like twisted is not installed. --- tornado/test/import_test.py | 5 ++++- tornado/test/twisted_test.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tornado/test/import_test.py b/tornado/test/import_test.py index 584f070d2f..4d628b060c 100644 --- a/tornado/test/import_test.py +++ b/tornado/test/import_test.py @@ -56,4 +56,7 @@ def test_import_twisted(self): except ImportError: pass else: - import tornado.platform.twisted + try: + import tornado.platform.twisted + except TypeError: + pass diff --git a/tornado/test/twisted_test.py b/tornado/test/twisted_test.py index 1a454817f3..f3129be1c5 100644 --- a/tornado/test/twisted_test.py +++ b/tornado/test/twisted_test.py @@ -37,7 +37,7 @@ from tornado.platform.twisted import TornadoReactor from zope.interface import implementer have_twisted = True -except ImportError: +except (ImportError, TypeError): have_twisted = False from tornado.httpclient import AsyncHTTPClient