From: Ben Darnell Date: Sun, 17 Jul 2011 19:46:22 +0000 (-0700) Subject: Make twisted tests run under python 2.5 X-Git-Tag: v2.1.0~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b19a6d318e29ab9e12a434b23f69df7ab5cbd60b;p=thirdparty%2Ftornado.git Make twisted tests run under python 2.5 --- diff --git a/tornado/platform/twistedreactor.py b/tornado/platform/twistedreactor.py index 40d7ea652..57a598621 100644 --- a/tornado/platform/twistedreactor.py +++ b/tornado/platform/twistedreactor.py @@ -23,6 +23,8 @@ tornado.platform.twistedreactor.install() from twisted.internet import reactor """ +from __future__ import with_statement, absolute_import + import functools import logging import sys diff --git a/tornado/test/twistedreactor_test.py b/tornado/test/twistedreactor_test.py index 0e72ccfe9..dc26cbfcf 100644 --- a/tornado/test/twistedreactor_test.py +++ b/tornado/test/twistedreactor_test.py @@ -116,7 +116,9 @@ class ReactorCallFromThreadTest(unittest.TestCase): self._thread.join() def _newThreadRun(self): - self.assertEqual(self._thread.ident, thread.get_ident()) + self.assertNotEqual(self._mainThread, thread.get_ident()) + if hasattr(self._thread, 'ident'): # new in python 2.6 + self.assertEqual(self._thread.ident, thread.get_ident()) self._reactor.callFromThread(self._fnCalledFromThread) def _fnCalledFromThread(self):