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

Method test_config_8_ok

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

Source from the content-addressed store, hash-verified

3460
3461 # Same as test_config_7_ok but don't disable old loggers.
3462 def test_config_8_ok(self):
3463 with support.captured_stdout() as output:
3464 self.apply_config(self.config1)
3465 logger = logging.getLogger("compiler.parser")
3466 # All will output a message
3467 logger.info(self.next_message())
3468 logger.error(self.next_message())
3469 self.assert_log_lines([
3470 ('INFO', '1'),
3471 ('ERROR', '2'),
3472 ], stream=output)
3473 # Original logger output is empty.
3474 self.assert_log_lines([])
3475 with support.captured_stdout() as output:
3476 self.apply_config(self.config8)
3477 self.check_handler('hand1', logging.StreamHandler)
3478 logger = logging.getLogger("compiler.parser")
3479 self.assertFalse(logger.disabled)
3480 # Both will output a message
3481 logger.info(self.next_message())
3482 logger.error(self.next_message())
3483 logger = logging.getLogger("compiler.lexer")
3484 # Both will output a message
3485 logger.info(self.next_message())
3486 logger.error(self.next_message())
3487 self.assert_log_lines([
3488 ('INFO', '3'),
3489 ('ERROR', '4'),
3490 ('INFO', '5'),
3491 ('ERROR', '6'),
3492 ], stream=output)
3493 # Original logger output is empty.
3494 self.assert_log_lines([])
3495
3496 def test_config_8a_ok(self):
3497 with support.captured_stdout() as output:

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected