diff options
author | Jesse Noller <jnoller@gmail.com> | 2009-11-21 14:38:23 (GMT) |
---|---|---|
committer | Jesse Noller <jnoller@gmail.com> | 2009-11-21 14:38:23 (GMT) |
commit | 814d02dcd1b30a98f9a34c710be35de6db82aa40 (patch) | |
tree | 72a84dcd59377fdad528d78757c8431a7cc8d735 | |
parent | 7bdd8d946ba3913ad8631f4d7bbc952f16144747 (diff) | |
download | cpython-814d02dcd1b30a98f9a34c710be35de6db82aa40.zip cpython-814d02dcd1b30a98f9a34c710be35de6db82aa40.tar.gz cpython-814d02dcd1b30a98f9a34c710be35de6db82aa40.tar.bz2 |
issue6615: Additional test for logging support in multiprocessing
-rw-r--r-- | Lib/test/test_multiprocessing.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index b16629b..07d7a02 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1722,6 +1722,26 @@ class _TestLogging(BaseTestCase): 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 # |