]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Initialize member variables in AsyncTestCase.__init__ instead of setUp
authorBen Darnell <ben@bendarnell.com>
Mon, 16 Aug 2010 01:04:34 +0000 (18:04 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 16 Aug 2010 01:04:34 +0000 (18:04 -0700)
to avoid masking the real error in _stack_context() if run() throws an
exception.

tornado/testing.py

index b810edf26437c767217e08a4dc2e13e2b8dee354..ec25d5c969244895596baac6fcf936faa1a00a39 100644 (file)
@@ -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.