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

Method test_config7_ok

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

Source from the content-addressed store, hash-verified

3430 self.assertRaises(Exception, self.apply_config, self.config6)
3431
3432 def test_config7_ok(self):
3433 with support.captured_stdout() as output:
3434 self.apply_config(self.config1)
3435 logger = logging.getLogger("compiler.parser")
3436 # Both will output a message
3437 logger.info(self.next_message())
3438 logger.error(self.next_message())
3439 self.assert_log_lines([
3440 ('INFO', '1'),
3441 ('ERROR', '2'),
3442 ], stream=output)
3443 # Original logger output is empty.
3444 self.assert_log_lines([])
3445 with support.captured_stdout() as output:
3446 self.apply_config(self.config7)
3447 self.check_handler('hand1', logging.StreamHandler)
3448 logger = logging.getLogger("compiler.parser")
3449 self.assertTrue(logger.disabled)
3450 logger = logging.getLogger("compiler.lexer")
3451 # Both will output a message
3452 logger.info(self.next_message())
3453 logger.error(self.next_message())
3454 self.assert_log_lines([
3455 ('INFO', '3'),
3456 ('ERROR', '4'),
3457 ], stream=output)
3458 # Original logger output is empty.
3459 self.assert_log_lines([])
3460
3461 # Same as test_config_7_ok but don't disable old loggers.
3462 def test_config_8_ok(self):

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
assertTrueMethod · 0.80
infoMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected