]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Suppress tornado.access logs in tests, and remove LogTrapTestCase
authorBen Darnell <ben@bendarnell.com>
Sun, 9 Sep 2012 20:23:49 +0000 (13:23 -0700)
committerBen Darnell <ben@bendarnell.com>
Sun, 9 Sep 2012 20:23:49 +0000 (13:23 -0700)
from tests that no longer produce any logs.

tornado/test/auth_test.py
tornado/test/httpclient_test.py
tornado/test/httpserver_test.py
tornado/test/ioloop_test.py
tornado/test/runtests.py
tornado/test/simple_httpclient_test.py
tornado/test/template_test.py
tornado/test/testing_test.py
tornado/test/web_test.py
tornado/test/wsgi_test.py

index 916194d29120f1e9286b12a569e0bd9e614cc9f7..6459d4c1d836facd75de396a8155ccf0658a3069 100644 (file)
@@ -7,7 +7,7 @@
 from __future__ import absolute_import, division, with_statement
 from tornado.auth import OpenIdMixin, OAuthMixin, OAuth2Mixin
 from tornado.escape import json_decode
-from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase
+from tornado.testing import AsyncHTTPTestCase
 from tornado.util import b
 from tornado.web import RequestHandler, Application, asynchronous
 
@@ -101,7 +101,7 @@ class OAuth2ClientLoginHandler(RequestHandler, OAuth2Mixin):
         self.authorize_redirect()
 
 
-class AuthTest(AsyncHTTPTestCase, LogTrapTestCase):
+class AuthTest(AsyncHTTPTestCase):
     def get_app(self):
         return Application(
             [
index f1ceed9819ddbdf7ede39293bba3e53ace4a9d13..08afff085dd0c396092102200cd2010c4ba4ebe3 100644 (file)
@@ -11,7 +11,7 @@ from tornado.escape import utf8
 from tornado.httpclient import AsyncHTTPClient
 from tornado.iostream import IOStream
 from tornado import netutil
-from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase, get_unused_port
+from tornado.testing import AsyncHTTPTestCase, get_unused_port
 from tornado.util import b, bytes_type
 from tornado.web import Application, RequestHandler, url
 
@@ -59,7 +59,7 @@ class EchoPostHandler(RequestHandler):
 # test suite.
 
 
-class HTTPClientCommonTestCase(AsyncHTTPTestCase, LogTrapTestCase):
+class HTTPClientCommonTestCase(AsyncHTTPTestCase):
     def get_app(self):
         return Application([
             url("/hello", HelloWorldHandler),
index 69af3a0ed4e47f7a23facf25477ac49e1099eaa9..bb01843fd35f3da418317b7e885b0c3cfb507a2d 100644 (file)
@@ -25,7 +25,7 @@ except ImportError:
     ssl = None
 
 
-class HandlerBaseTestCase(AsyncHTTPTestCase, LogTrapTestCase):
+class HandlerBaseTestCase(AsyncHTTPTestCase):
     def get_app(self):
         return Application([('/', self.__class__.Handler)])
 
@@ -166,7 +166,7 @@ class RawRequestHTTPConnection(simple_httpclient._HTTPConnection):
 # This test is also called from wsgi_test
 
 
-class HTTPConnectionTest(AsyncHTTPTestCase, LogTrapTestCase):
+class HTTPConnectionTest(AsyncHTTPTestCase):
     def get_handlers(self):
         return [("/multipart", MultipartTestHandler),
                 ("/hello", HelloWorldRequestHandler)]
@@ -288,7 +288,7 @@ class TypeCheckHandler(RequestHandler):
                                                          actual_type)
 
 
-class HTTPServerTest(AsyncHTTPTestCase, LogTrapTestCase):
+class HTTPServerTest(AsyncHTTPTestCase):
     def get_app(self):
         return Application([("/echo", EchoHandler),
                             ("/typecheck", TypeCheckHandler),
@@ -352,7 +352,7 @@ class XHeaderTest(HandlerBaseTestCase):
             "127.0.0.1")
 
 
-class UnixSocketTest(AsyncTestCase, LogTrapTestCase):
+class UnixSocketTest(AsyncTestCase):
     """HTTPServers can listen on Unix sockets too.
 
     Why would you want to do this?  Nginx can proxy to backends listening
index 4e5e123c9ac2b2a8c9672f1c89d6117efa9d7eb8..63ef31f54f015a2247707c30182d3032b341e75a 100644 (file)
@@ -8,11 +8,11 @@ import time
 
 from tornado.ioloop import IOLoop
 from tornado.netutil import bind_sockets
-from tornado.testing import AsyncTestCase, LogTrapTestCase, get_unused_port
+from tornado.testing import AsyncTestCase, get_unused_port
 from tornado.test.util import unittest
 
 
-class TestIOLoop(AsyncTestCase, LogTrapTestCase):
+class TestIOLoop(AsyncTestCase):
     def test_add_callback_wakeup(self):
         # Make sure that add_callback from inside a running IOLoop
         # wakes up the IOLoop immediately instead of waiting for a timeout.
index 13c03ce85193d7b82a8a9a0d1bd286e23843f97e..adf761db40f35adf993660b08a242e0d859422eb 100644 (file)
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 
 from __future__ import absolute_import, division, with_statement
+import logging
 import textwrap
 import sys
 from tornado.test.util import unittest
@@ -66,6 +67,8 @@ if __name__ == '__main__':
     warnings.filterwarnings("error", category=DeprecationWarning,
                             module=r"tornado\..*")
 
+    logging.getLogger("tornado.access").setLevel(logging.CRITICAL)
+
     import tornado.testing
     kwargs = {}
     if sys.version_info >= (3, 2):
index 4ab01843186781557d29276766697b6c3223111e..f84f7631f829c641ef8a3a94f1ad9a85c4f0e312 100644 (file)
@@ -299,7 +299,7 @@ class SimpleHTTPClientTestCase(AsyncHTTPTestCase, LogTrapTestCase):
                             response.error)
 
 
-class CreateAsyncHTTPClientTestCase(AsyncTestCase, LogTrapTestCase):
+class CreateAsyncHTTPClientTestCase(AsyncTestCase):
     def setUp(self):
         super(CreateAsyncHTTPClientTestCase, self).setUp()
         self.saved = AsyncHTTPClient._save_configuration()
@@ -336,7 +336,7 @@ class CreateAsyncHTTPClientTestCase(AsyncTestCase, LogTrapTestCase):
             self.assertEqual(client.max_clients, 14)
 
 
-class HTTP100ContinueTestCase(AsyncHTTPTestCase, LogTrapTestCase):
+class HTTP100ContinueTestCase(AsyncHTTPTestCase):
     def respond_100(self, request):
         self.request = request
         self.request.connection.stream.write(
index 6e14abb92d0853bcbe89c85979e90bdc66a361e4..793b1bbb4dbdca65a27071de4d9e57c8fecf501c 100644 (file)
@@ -6,10 +6,11 @@ import traceback
 from tornado.escape import utf8, native_str, to_unicode
 from tornado.template import Template, DictLoader, ParseError, Loader
 from tornado.testing import LogTrapTestCase
+from tornado.test.util import unittest
 from tornado.util import b, bytes_type, ObjectDict
 
 
-class TemplateTest(LogTrapTestCase):
+class TemplateTest(unittest.TestCase):
     def test_simple(self):
         template = Template("Hello {{ name }}!")
         self.assertEqual(template.generate(name="Ben"),
@@ -235,7 +236,7 @@ three{%end%}
                             traceback.format_exc())
 
 
-class AutoEscapeTest(LogTrapTestCase):
+class AutoEscapeTest(unittest.TestCase):
     def setUp(self):
         self.templates = {
             "escaped.html": "{% autoescape xhtml_escape %}{{ name }}",
@@ -359,7 +360,7 @@ raw: {% raw name %}""",
                          b("""s = "['not a string']"\n"""))
 
 
-class TemplateLoaderTest(LogTrapTestCase):
+class TemplateLoaderTest(unittest.TestCase):
     def setUp(self):
         self.loader = Loader(os.path.join(os.path.dirname(__file__), "templates"))
 
index 77f55e7e5c69a6a666e914a02cd0df4fad47e3fe..943f49f6c7d039e21328826fcb0b1293d2cb2d57 100644 (file)
@@ -2,11 +2,11 @@
 
 from __future__ import absolute_import, division, with_statement
 import time
-from tornado.testing import AsyncTestCase, LogTrapTestCase
+from tornado.testing import AsyncTestCase
 from tornado.test.util import unittest
 
 
-class AsyncTestCaseTest(AsyncTestCase, LogTrapTestCase):
+class AsyncTestCaseTest(AsyncTestCase):
     def test_exception_in_callback(self):
         self.io_loop.add_callback(lambda: 1 / 0)
         try:
index 3418ec42ef1afd28493acc4d8600a4157dad2b80..e13adaa1d5a2534b2482327f0c10dd4f4b680b5f 100644 (file)
@@ -188,7 +188,7 @@ class AuthRedirectRequestHandler(RequestHandler):
         self.send_error(500)
 
 
-class AuthRedirectTest(AsyncHTTPTestCase, LogTrapTestCase):
+class AuthRedirectTest(AsyncHTTPTestCase):
     def get_app(self):
         return Application([('/relative', AuthRedirectRequestHandler,
                              dict(login_url='/login')),
@@ -269,7 +269,7 @@ class EchoHandler(RequestHandler):
                         args=recursive_unicode(self.request.arguments)))
 
 
-class RequestEncodingTest(AsyncHTTPTestCase, LogTrapTestCase):
+class RequestEncodingTest(AsyncHTTPTestCase):
     def get_app(self):
         return Application([
                 ("/group/(.*)", EchoHandler),
@@ -449,7 +449,7 @@ class HeaderInjectionHandler(RequestHandler):
 
 
 # This test is shared with wsgi_test.py
-class WSGISafeWebTest(AsyncHTTPTestCase, LogTrapTestCase):
+class WSGISafeWebTest(AsyncHTTPTestCase):
     COOKIE_SECRET = "WebTest.COOKIE_SECRET"
 
     def get_app(self):
@@ -589,7 +589,7 @@ js_embed()
         self.assertEqual(response.body, b("ok"))
 
 
-class NonWSGIWebTests(AsyncHTTPTestCase, LogTrapTestCase):
+class NonWSGIWebTests(AsyncHTTPTestCase):
     def get_app(self):
         urls = [
             ("/flow_control", FlowControlHandler),
@@ -688,7 +688,7 @@ class ErrorResponseTest(AsyncHTTPTestCase, LogTrapTestCase):
         self.assertEqual(b(""), response.body)
 
 
-class StaticFileTest(AsyncHTTPTestCase, LogTrapTestCase):
+class StaticFileTest(AsyncHTTPTestCase):
     def get_app(self):
         class StaticUrlHandler(RequestHandler):
             def get(self, path):
@@ -801,7 +801,7 @@ class CustomStaticFileTest(AsyncHTTPTestCase, LogTrapTestCase):
         self.assertEqual(response.body, b("/static/foo.42.txt"))
 
 
-class NamedURLSpecGroupsTest(AsyncHTTPTestCase, LogTrapTestCase):
+class NamedURLSpecGroupsTest(AsyncHTTPTestCase):
     def get_app(self):
         class EchoHandler(RequestHandler):
             def get(self, path):
index 4eb4bfa9305e76ca49969c180d567d7ee13538b2..a143248070d6b3d182715f318076af9309973c6b 100644 (file)
@@ -3,13 +3,13 @@ from wsgiref.validate import validator
 
 from tornado.escape import json_decode
 from tornado.test.httpserver_test import TypeCheckHandler
-from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase
+from tornado.testing import AsyncHTTPTestCase
 from tornado.util import b
 from tornado.web import RequestHandler
 from tornado.wsgi import WSGIApplication, WSGIContainer
 
 
-class WSGIContainerTest(AsyncHTTPTestCase, LogTrapTestCase):
+class WSGIContainerTest(AsyncHTTPTestCase):
     def wsgi_app(self, environ, start_response):
         status = "200 OK"
         response_headers = [("Content-Type", "text/plain")]
@@ -24,7 +24,7 @@ class WSGIContainerTest(AsyncHTTPTestCase, LogTrapTestCase):
         self.assertEqual(response.body, b("Hello world!"))
 
 
-class WSGIApplicationTest(AsyncHTTPTestCase, LogTrapTestCase):
+class WSGIApplicationTest(AsyncHTTPTestCase):
     def get_app(self):
         class HelloHandler(RequestHandler):
             def get(self):