]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Remove inaccurate IOLoop logging test cases.
authorBen Darnell <ben@bendarnell.com>
Mon, 6 Jan 2014 23:49:33 +0000 (18:49 -0500)
committerBen Darnell <ben@bendarnell.com>
Mon, 6 Jan 2014 23:49:33 +0000 (18:49 -0500)
tornado/test/ioloop_test.py

index daa1beab5df0b5e0f2fc0878fe03c79c3b2ab67c..fa863e611cfa13f19d280ec98fa5de76761953cd 100644 (file)
@@ -12,7 +12,7 @@ import threading
 import time
 
 from tornado import gen
-from tornado.ioloop import IOLoop, TimeoutError
+from tornado.ioloop import IOLoop, PollIOLoop, TimeoutError
 from tornado.stack_context import ExceptionStackContext, StackContext, wrap, NullContext
 from tornado.testing import AsyncTestCase, bind_unused_port
 from tornado.test.util import unittest, skipIfNonUnix, skipOnTravis
@@ -22,14 +22,6 @@ try:
 except ImportError:
     futures = None
 
-try:
-    from unittest import mock  # python 3.3+
-except ImportError:
-    try:
-        import mock  # third-party mock package
-    except ImportError:
-        mock = None
-
 
 class TestIOLoop(AsyncTestCase):
     @skipOnTravis
@@ -339,43 +331,5 @@ class TestIOLoopRunSync(unittest.TestCase):
         self.assertRaises(TimeoutError, self.io_loop.run_sync, f, timeout=0.01)
 
 
-class TestIOLoopLogging(AsyncTestCase):
-
-    @unittest.skipIf(mock is None, 'mock package not present')
-    def test_basic_config_invoked(self):
-        """If no loggers have been defined, logging.basicConfig should be called
-        test for the presence of a root logger, start IOloop and then test
-        to see if one has been added
-
-        """
-        with mock.patch('logging.basicConfig') as basicConfig:
-            self.io_loop.add_timeout(datetime.timedelta(microseconds=1),
-                                     self.stop)
-            self.wait()
-            basicConfig.assert_called_once()
-
-    @unittest.skipIf(mock is None, 'mock package not present')
-    def test_basic_config_not_invoked(self):
-        """The setup_logging method will check for getLogger().handlers,
-        getLogger('tornado').handlers and
-        getLogger('tornado.application').handlers. If all are empty, it will
-        invoke basicConfig. Test to make sure all three are called, all three
-        are checked and basicConfig is not invoked because there is a handler
-        returned (for each).
-
-        """
-        with mock.patch('logging.getLogger') as getLogger:
-            with mock.patch('logging.basicConfig') as basicConfig:
-                getLogger.handlers = [True]
-                self.io_loop.add_timeout(datetime.timedelta(microseconds=1),
-                                         self.stop)
-                self.wait()
-                basicConfig.assert_not_called()
-                getLogger.assert_has_calls([mock.call(),
-                                            mock.call('tornado'),
-                                            mock.call('tornado.application')])
-                self.assertEqual(getLogger.call_count, 3)
-
-
 if __name__ == "__main__":
     unittest.main()