]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
AsyncHTTPTestCase no longer closes AsyncHTTPClients on the global IOLoop.
authorBen Darnell <ben@bendarnell.com>
Tue, 30 Oct 2012 05:33:54 +0000 (22:33 -0700)
committerBen Darnell <ben@bendarnell.com>
Tue, 30 Oct 2012 05:33:54 +0000 (22:33 -0700)
Code that uses the global IOLoop may retain a global reference to
an AsyncHTTPClient as well, which would become inoperable after a test
had closed it.

tornado/testing.py
website/sphinx/releases/next.rst

index 602318f8e7b1e91434952d51e1915988b6253449..36928c446244e4015ce6a872316ed735a09f18b7 100644 (file)
@@ -317,7 +317,9 @@ class AsyncHTTPTestCase(AsyncTestCase):
 
     def tearDown(self):
         self.http_server.stop()
-        self.http_client.close()
+        if (not IOLoop.initialized() or
+            self.http_client.io_loop is not IOLoop.instance()):
+            self.http_client.close()
         super(AsyncHTTPTestCase, self).tearDown()
 
 
index e5a2b0a7dcdd603be65d5e96fb8641d1ebfb6c95..bb62777bfc03e71d3ababfba3e0a44f36c38a676 100644 (file)
@@ -150,3 +150,5 @@ In progress
 * New class `tornado.platform.twisted.TwistedIOLoop` allows Tornado
   code to be run on the Twisted reactor (as opposed to the existing
   `TornadoReactor`, which bridges the gap in the other direction).
+* `AsyncHTTPTestCase` no longer calls `AsyncHTTPClient.close` for tests
+  that use the singletion `IOLoop.instance`.