From: Ben Darnell Date: Mon, 16 Aug 2010 01:04:34 +0000 (-0700) Subject: Initialize member variables in AsyncTestCase.__init__ instead of setUp X-Git-Tag: v1.1.0~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=551ea94d2475f6702f652e49698a20be97c26b2e;p=thirdparty%2Ftornado.git Initialize member variables in AsyncTestCase.__init__ instead of setUp to avoid masking the real error in _stack_context() if run() throws an exception. --- diff --git a/tornado/testing.py b/tornado/testing.py index b810edf26..ec25d5c96 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -74,13 +74,17 @@ class AsyncTestCase(unittest.TestCase): response = self.wait() # Test contents of response """ - def setUp(self): - self.io_loop = self.get_new_ioloop() + def __init__(self, *args, **kwargs): + super(AsyncTestCase, self).__init__(*args, **kwargs) self.__stopped = False self.__running = False self.__failure = None self.__stop_args = None + def setUp(self): + super(AsyncTestCase, self).setUp() + self.io_loop = self.get_new_ioloop() + def tearDown(self): if self.io_loop is not tornado.ioloop.IOLoop.instance(): # Try to clean up any file descriptors left open in the ioloop.