[Python-checkins] r76438 - python/trunk/Lib/test/test_multiprocessing.py

jesse.noller python-checkins at python.org
Sat Nov 21 15:38:24 CET 2009


Author: jesse.noller
Date: Sat Nov 21 15:38:23 2009
New Revision: 76438

Log:
issue6615: Additional test for logging support in multiprocessing

Modified:
   python/trunk/Lib/test/test_multiprocessing.py

Modified: python/trunk/Lib/test/test_multiprocessing.py
==============================================================================
--- python/trunk/Lib/test/test_multiprocessing.py	(original)
+++ python/trunk/Lib/test/test_multiprocessing.py	Sat Nov 21 15:38:23 2009
@@ -1722,6 +1722,26 @@
         root_logger.setLevel(root_level)
         logger.setLevel(level=LOG_LEVEL)
 
+
+class _TestLoggingProcessName(BaseTestCase):
+
+    def handle(self, record):
+        assert record.processName == multiprocessing.current_process().name
+        self.__handled = True
+
+    def test_logging(self):
+        handler = logging.Handler()
+        handler.handle = self.handle
+        self.__handled = False
+        # Bypass getLogger() and side-effects
+        logger = logging.getLoggerClass()(
+                'multiprocessing.test.TestLoggingProcessName')
+        logger.addHandler(handler)
+        logger.propagate = False
+
+        logger.warn('foo')
+        assert self.__handled
+
 #
 # Test to verify handle verification, see issue 3321
 #


More information about the Python-checkins mailing list