Skip to content

Commit

Permalink
Disable tests when old versions of twisted are installed.
Browse files Browse the repository at this point in the history
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 <module>
    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.
  • Loading branch information
apenwarr committed Aug 14, 2012
1 parent 4daeaeb commit a5bc9b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tornado/test/import_test.py
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tornado/test/twisted_test.py
Expand Up @@ -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
Expand Down

0 comments on commit a5bc9b5

Please sign in to comment.