mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
issue6615: Additional test for logging support in multiprocessing
This commit is contained in:
parent
7bdd8d946b
commit
814d02dcd1
1 changed files with 20 additions and 0 deletions
|
@ -1722,6 +1722,26 @@ class _TestLogging(BaseTestCase):
|
||||||
root_logger.setLevel(root_level)
|
root_logger.setLevel(root_level)
|
||||||
logger.setLevel(level=LOG_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
|
# Test to verify handle verification, see issue 3321
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue