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

Method test_nested_with_virtual_parent

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

Source from the content-addressed store, hash-verified

300 ])
301
302 def test_nested_with_virtual_parent(self):
303 # Logging levels when some parent does not exist yet.
304 m = self.next_message
305
306 INF = logging.getLogger("INF")
307 GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
308 CHILD = logging.getLogger("INF.BADPARENT")
309 INF.setLevel(logging.INFO)
310
311 # These should log.
312 GRANDCHILD.log(logging.FATAL, m())
313 GRANDCHILD.info(m())
314 CHILD.log(logging.FATAL, m())
315 CHILD.info(m())
316
317 # These should not log.
318 GRANDCHILD.debug(m())
319 CHILD.debug(m())
320
321 self.assert_log_lines([
322 ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
323 ('INF.BADPARENT.UNDEF', 'INFO', '2'),
324 ('INF.BADPARENT', 'CRITICAL', '3'),
325 ('INF.BADPARENT', 'INFO', '4'),
326 ])
327
328 def test_regression_22386(self):
329 """See issue #22386 for more information."""

Callers

nothing calls this directly

Calls 7

getLoggerMethod · 0.80
assert_log_linesMethod · 0.80
mFunction · 0.50
setLevelMethod · 0.45
logMethod · 0.45
infoMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected