From: Ben Darnell Date: Fri, 17 Jan 2014 03:49:31 +0000 (-0500) Subject: Add better debugging for ImportErrors resulting from TORNADO_EXTENSION=1 X-Git-Tag: v3.2.1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18676fa96964d7678649b3f87b7a245dbf717960;p=thirdparty%2Ftornado.git Add better debugging for ImportErrors resulting from TORNADO_EXTENSION=1 --- diff --git a/tornado/test/websocket_test.py b/tornado/test/websocket_test.py index f48f00081..01fee72b2 100644 --- a/tornado/test/websocket_test.py +++ b/tornado/test/websocket_test.py @@ -1,10 +1,24 @@ from __future__ import absolute_import, division, print_function, with_statement + +import traceback + from tornado.concurrent import Future from tornado.httpclient import HTTPError, HTTPRequest from tornado.log import gen_log from tornado.testing import AsyncHTTPTestCase, gen_test, bind_unused_port, ExpectLog from tornado.test.util import unittest, skipOnTravis from tornado.web import Application, RequestHandler + +try: + import tornado.websocket +except ImportError: + # The unittest module presents misleading errors on ImportError + # (it acts as if websocket_test could not be found, hiding the underlying + # error). If we get an ImportError here (which could happen due to + # TORNADO_EXTENSION=1), print some extra information before failing. + traceback.print_exc() + raise + from tornado.websocket import WebSocketHandler, websocket_connect, WebSocketError, _websocket_mask_python try: