[Python-checkins] cpython (merge 3.2 -> default): Issue #11852: Merge fix from 3.2.

vinay.sajip python-checkins at python.org
Fri Apr 15 23:29:47 CEST 2011


http://hg.python.org/cpython/rev/f5a6367e11e2
changeset:   69383:f5a6367e11e2
parent:      69381:4607c27bbab7
parent:      69382:3b700e6704b3
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Fri Apr 15 22:29:15 2011 +0100
summary:
  Issue #11852: Merge fix from 3.2.

files:
  Lib/logging/handlers.py  |   2 ++
  Lib/test/test_logging.py |  16 ++++++++++++++++
  Misc/NEWS                |   2 ++
  3 files changed, 20 insertions(+), 0 deletions(-)


diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -26,6 +26,8 @@
 
 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
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -41,6 +41,7 @@
 import sys
 import tempfile
 from test.support import captured_stdout, run_with_locale, run_unittest, patch
+from test.support import TestHandler, Matcher
 import textwrap
 import unittest
 import warnings
@@ -2108,6 +2109,21 @@
         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 = {
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -110,6 +110,8 @@
 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.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list