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

Method test_config7_ok

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

Source from the content-addressed store, hash-verified

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

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