MCPcopy Create free account
hub / github.com/RustPython/RustPython / test_config_8_ok

Method test_config_8_ok

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

Source from the content-addressed store, hash-verified

3394
3395 # Same as test_config_7_ok but don't disable old loggers.
3396 def test_config_8_ok(self):
3397 with support.captured_stdout() as output:
3398 self.apply_config(self.config1)
3399 logger = logging.getLogger("compiler.parser")
3400 # All will output a message
3401 logger.info(self.next_message())
3402 logger.error(self.next_message())
3403 self.assert_log_lines([
3404 ('INFO', '1'),
3405 ('ERROR', '2'),
3406 ], stream=output)
3407 # Original logger output is empty.
3408 self.assert_log_lines([])
3409 with support.captured_stdout() as output:
3410 self.apply_config(self.config8)
3411 self.check_handler('hand1', logging.StreamHandler)
3412 logger = logging.getLogger("compiler.parser")
3413 self.assertFalse(logger.disabled)
3414 # Both will output a message
3415 logger.info(self.next_message())
3416 logger.error(self.next_message())
3417 logger = logging.getLogger("compiler.lexer")
3418 # Both will output a message
3419 logger.info(self.next_message())
3420 logger.error(self.next_message())
3421 self.assert_log_lines([
3422 ('INFO', '3'),
3423 ('ERROR', '4'),
3424 ('INFO', '5'),
3425 ('ERROR', '6'),
3426 ], stream=output)
3427 # Original logger output is empty.
3428 self.assert_log_lines([])
3429
3430 def test_config_8a_ok(self):
3431 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