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

Method test_config7_ok

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

Source from the content-addressed store, hash-verified

1651 self.test_config1_ok(config=self.config6)
1652
1653 def test_config7_ok(self):
1654 with support.captured_stdout() as output:
1655 self.apply_config(self.config1a)
1656 logger = logging.getLogger("compiler.parser")
1657 # See issue #11424. compiler-hyphenated sorts
1658 # between compiler and compiler.xyz and this
1659 # was preventing compiler.xyz from being included
1660 # in the child loggers of compiler because of an
1661 # overzealous loop termination condition.
1662 hyphenated = logging.getLogger('compiler-hyphenated')
1663 # All will output a message
1664 logger.info(self.next_message())
1665 logger.error(self.next_message())
1666 hyphenated.critical(self.next_message())
1667 self.assert_log_lines([
1668 ('INFO', '1'),
1669 ('ERROR', '2'),
1670 ('CRITICAL', '3'),
1671 ], stream=output)
1672 # Original logger output is empty.
1673 self.assert_log_lines([])
1674 with support.captured_stdout() as output:
1675 self.apply_config(self.config7)
1676 logger = logging.getLogger("compiler.parser")
1677 self.assertFalse(logger.disabled)
1678 # Both will output a message
1679 logger.info(self.next_message())
1680 logger.error(self.next_message())
1681 logger = logging.getLogger("compiler.lexer")
1682 # Both will output a message
1683 logger.info(self.next_message())
1684 logger.error(self.next_message())
1685 # Will not appear
1686 hyphenated.critical(self.next_message())
1687 self.assert_log_lines([
1688 ('INFO', '4'),
1689 ('ERROR', '5'),
1690 ('INFO', '6'),
1691 ('ERROR', '7'),
1692 ], stream=output)
1693 # Original logger output is empty.
1694 self.assert_log_lines([])
1695
1696 def test_config8_ok(self):
1697

Callers

nothing calls this directly

Calls 8

apply_configMethod · 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