From b19a6d318e29ab9e12a434b23f69df7ab5cbd60b Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 17 Jul 2011 12:46:22 -0700 Subject: [PATCH] Make twisted tests run under python 2.5 --- tornado/platform/twistedreactor.py | 2 ++ tornado/test/twistedreactor_test.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) 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): -- 2.47.2