MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_config_8a_ok

Method test_config_8a_ok

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

Source from the content-addressed store, hash-verified

3428 self.assert_log_lines([])
3429
3430 def test_config_8a_ok(self):
3431 with support.captured_stdout() as output:
3432 self.apply_config(self.config1a)
3433 self.check_handler('hand1', logging.StreamHandler)
3434 logger = logging.getLogger("compiler.parser")
3435 # See issue #11424. compiler-hyphenated sorts
3436 # between compiler and compiler.xyz and this
3437 # was preventing compiler.xyz from being included
3438 # in the child loggers of compiler because of an
3439 # overzealous loop termination condition.
3440 hyphenated = logging.getLogger('compiler-hyphenated')
3441 # All will output a message
3442 logger.info(self.next_message())
3443 logger.error(self.next_message())
3444 hyphenated.critical(self.next_message())
3445 self.assert_log_lines([
3446 ('INFO', '1'),
3447 ('ERROR', '2'),
3448 ('CRITICAL', '3'),
3449 ], stream=output)
3450 # Original logger output is empty.
3451 self.assert_log_lines([])
3452 with support.captured_stdout() as output:
3453 self.apply_config(self.config8a)
3454 self.check_handler('hand1', logging.StreamHandler)
3455 logger = logging.getLogger("compiler.parser")
3456 self.assertFalse(logger.disabled)
3457 # Both will output a message
3458 logger.info(self.next_message())
3459 logger.error(self.next_message())
3460 logger = logging.getLogger("compiler.lexer")
3461 # Both will output a message
3462 logger.info(self.next_message())
3463 logger.error(self.next_message())
3464 # Will not appear
3465 hyphenated.critical(self.next_message())
3466 self.assert_log_lines([
3467 ('INFO', '4'),
3468 ('ERROR', '5'),
3469 ('INFO', '6'),
3470 ('ERROR', '7'),
3471 ], stream=output)
3472 # Original logger output is empty.
3473 self.assert_log_lines([])
3474
3475 def test_config_9_ok(self):
3476 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