Skip to content
Browse files

AsyncHTTPTestCase no longer closes AsyncHTTPClients on the global IOL…

…oop.

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.
  • Loading branch information...
1 parent 317508b commit 81475d5172fbb875ac6ed9cfd4e333f7c04c5497 @bdarnell bdarnell committed
Showing with 5 additions and 1 deletion.
  1. +3 −1 tornado/testing.py
  2. +2 −0 website/sphinx/releases/next.rst
View
4 tornado/testing.py
@@ -317,7 +317,9 @@ def get_url(self, path):
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()
View
2 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`.

0 comments on commit 81475d5

Please sign in to comment.
Something went wrong with that request. Please try again.