From: Ben Darnell Date: Tue, 30 Oct 2012 05:33:54 +0000 (-0700) Subject: AsyncHTTPTestCase no longer closes AsyncHTTPClients on the global IOLoop. X-Git-Tag: v3.0.0~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81475d5172fbb875ac6ed9cfd4e333f7c04c5497;p=thirdparty%2Ftornado.git AsyncHTTPTestCase no longer closes AsyncHTTPClients on the global IOLoop. 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. --- diff --git a/tornado/testing.py b/tornado/testing.py index 602318f8e..36928c446 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -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() diff --git a/website/sphinx/releases/next.rst b/website/sphinx/releases/next.rst index e5a2b0a7d..bb62777bf 100644 --- a/website/sphinx/releases/next.rst +++ b/website/sphinx/releases/next.rst @@ -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`.