diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-04-15 21:27:17 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-04-15 21:27:17 (GMT) |
commit | e723e96103493c6ee5a3125490b50dd63c1eebf9 (patch) | |
tree | 2f333a6050b22a9a8b1b14aa4b24c6c4a6cbca9b | |
parent | 6c9e5b779f4cbb16f529f0451a07eaa57caad896 (diff) | |
download | cpython-e723e96103493c6ee5a3125490b50dd63c1eebf9.zip cpython-e723e96103493c6ee5a3125490b50dd63c1eebf9.tar.gz cpython-e723e96103493c6ee5a3125490b50dd63c1eebf9.tar.bz2 |
Issue #11852: Add missing imports and update tests.
-rw-r--r-- | Lib/logging/handlers.py | 2 | ||||
-rw-r--r-- | Lib/test/test_logging.py | 16 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 20 insertions, 0 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 96384bd..3a48628 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -26,6 +26,8 @@ To use, simply 'import logging.handlers' and log away! import logging, socket, os, pickle, struct, time, re from stat import ST_DEV, ST_INO, ST_MTIME +import queue +import threading try: import codecs diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index b62545c..6623a0f 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -41,6 +41,7 @@ import struct import sys import tempfile from test.support import captured_stdout, run_with_locale, run_unittest +from test.support import TestHandler, Matcher import textwrap import unittest import warnings @@ -2092,6 +2093,21 @@ class QueueHandlerTest(BaseTest): self.assertEqual(data.name, self.que_logger.name) self.assertEqual((data.msg, data.args), (msg, None)) + def test_queue_listener(self): + handler = TestHandler(Matcher()) + listener = logging.handlers.QueueListener(self.queue, handler) + listener.start() + try: + self.que_logger.warning(self.next_message()) + self.que_logger.error(self.next_message()) + self.que_logger.critical(self.next_message()) + finally: + listener.stop() + self.assertTrue(handler.matches(levelno=logging.WARNING, message='1')) + self.assertTrue(handler.matches(levelno=logging.ERROR, message='2')) + self.assertTrue(handler.matches(levelno=logging.CRITICAL, message='3')) + + class FormatterTest(unittest.TestCase): def setUp(self): self.common = { @@ -60,6 +60,8 @@ Core and Builtins Library ------- +- Issue #11852: Add missing imports and update tests. + - Issue #11467: Fix urlparse behavior when handling urls which contains scheme specific part only digits. Patch by Santoso Wijaya. |