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

Method test_config7_ok

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

Source from the content-addressed store, hash-verified

3364 self.assertRaises(Exception, self.apply_config, self.config6)
3365
3366 def test_config7_ok(self):
3367 with support.captured_stdout() as output:
3368 self.apply_config(self.config1)
3369 logger = logging.getLogger("compiler.parser")
3370 # Both will output a message
3371 logger.info(self.next_message())
3372 logger.error(self.next_message())
3373 self.assert_log_lines([
3374 ('INFO', '1'),
3375 ('ERROR', '2'),
3376 ], stream=output)
3377 # Original logger output is empty.
3378 self.assert_log_lines([])
3379 with support.captured_stdout() as output:
3380 self.apply_config(self.config7)
3381 self.check_handler('hand1', logging.StreamHandler)
3382 logger = logging.getLogger("compiler.parser")
3383 self.assertTrue(logger.disabled)
3384 logger = logging.getLogger("compiler.lexer")
3385 # Both will output a message
3386 logger.info(self.next_message())
3387 logger.error(self.next_message())
3388 self.assert_log_lines([
3389 ('INFO', '3'),
3390 ('ERROR', '4'),
3391 ], stream=output)
3392 # Original logger output is empty.
3393 self.assert_log_lines([])
3394
3395 # Same as test_config_7_ok but don't disable old loggers.
3396 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