Skip to content
Browse files

Update test to use new asynchronous error handling

  • Loading branch information...
1 parent d29d366 commit d58ee7084976f99e895edfe7a02a71b1b2c70889 @alekstorm committed
Showing with 4 additions and 3 deletions.
  1. +4 −3 tornado/test/
7 tornado/test/
@@ -12,6 +12,7 @@
from tornado.netutil import bind_sockets
from tornado.process import fork_processes, task_id
from tornado.simple_httpclient import SimpleAsyncHTTPClient, TCPConnectionException
+from tornado.stack_context import ExceptionStackContext
from tornado.testing import LogTrapTestCase, get_unused_port
from tornado.web import RequestHandler, Application
@@ -85,11 +86,11 @@ def get_url(path):
client = HTTPClient(SimpleAsyncHTTPClient)
def fetch(url, fail_ok=False):
- try:
- return client.fetch(get_url(url))
- except TCPConnectionException:
+ def handle_exception(type, value, traceback):
if not fail_ok:
+ with ExceptionStackContext(handle_exception):
+ return client.fetch(get_url(url))
# Make two processes exit abnormally
fetch("/?exit=2", fail_ok=True)

0 comments on commit d58ee70

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