MCPcopy Index your code
hub / github.com/python/cpython / test_config_8a_ok

Method test_config_8a_ok

Lib/test/test_logging.py:3496–3539  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3494 self.assert_log_lines([])
3495
3496 def test_config_8a_ok(self):
3497 with support.captured_stdout() as output:
3498 self.apply_config(self.config1a)
3499 self.check_handler('hand1', logging.StreamHandler)
3500 logger = logging.getLogger("compiler.parser")
3501 # See issue #11424. compiler-hyphenated sorts
3502 # between compiler and compiler.xyz and this
3503 # was preventing compiler.xyz from being included
3504 # in the child loggers of compiler because of an
3505 # overzealous loop termination condition.
3506 hyphenated = logging.getLogger('compiler-hyphenated')
3507 # All will output a message
3508 logger.info(self.next_message())
3509 logger.error(self.next_message())
3510 hyphenated.critical(self.next_message())
3511 self.assert_log_lines([
3512 ('INFO', '1'),
3513 ('ERROR', '2'),
3514 ('CRITICAL', '3'),
3515 ], stream=output)
3516 # Original logger output is empty.
3517 self.assert_log_lines([])
3518 with support.captured_stdout() as output:
3519 self.apply_config(self.config8a)
3520 self.check_handler('hand1', logging.StreamHandler)
3521 logger = logging.getLogger("compiler.parser")
3522 self.assertFalse(logger.disabled)
3523 # Both will output a message
3524 logger.info(self.next_message())
3525 logger.error(self.next_message())
3526 logger = logging.getLogger("compiler.lexer")
3527 # Both will output a message
3528 logger.info(self.next_message())
3529 logger.error(self.next_message())
3530 # Will not appear
3531 hyphenated.critical(self.next_message())
3532 self.assert_log_lines([
3533 ('INFO', '4'),
3534 ('ERROR', '5'),
3535 ('INFO', '6'),
3536 ('ERROR', '7'),
3537 ], stream=output)
3538 # Original logger output is empty.
3539 self.assert_log_lines([])
3540
3541 def test_config_9_ok(self):
3542 with support.captured_stdout() as output:

Callers

nothing calls this directly

Calls 9

apply_configMethod · 0.95
check_handlerMethod · 0.95
getLoggerMethod · 0.80
next_messageMethod · 0.80
assert_log_linesMethod · 0.80
assertFalseMethod · 0.80
infoMethod · 0.45
errorMethod · 0.45
criticalMethod · 0.45

Tested by

no test coverage detected