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

Method test_persistent_loggers

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

Source from the content-addressed store, hash-verified

2264 "but have been destroyed: %s" % (len(dead), ", ".join(dead)))
2265
2266 def test_persistent_loggers(self):
2267 # Logger objects are persistent and retain their configuration, even
2268 # if visible references are destroyed.
2269 self.root_logger.setLevel(logging.INFO)
2270 foo = logging.getLogger("foo")
2271 self._watch_for_survival(foo)
2272 foo.setLevel(logging.DEBUG)
2273 self.root_logger.debug(self.next_message())
2274 foo.debug(self.next_message())
2275 self.assert_log_lines([
2276 ('foo', 'DEBUG', '2'),
2277 ])
2278 del foo
2279 # foo has survived.
2280 self._assertTruesurvival()
2281 # foo has retained its settings.
2282 bar = logging.getLogger("foo")
2283 bar.debug(self.next_message())
2284 self.assert_log_lines([
2285 ('foo', 'DEBUG', '2'),
2286 ('foo', 'DEBUG', '3'),
2287 ])
2288
2289
2290class EncodingTest(BaseTest):

Callers

nothing calls this directly

Calls 7

_watch_for_survivalMethod · 0.95
_assertTruesurvivalMethod · 0.95
getLoggerMethod · 0.80
next_messageMethod · 0.80
assert_log_linesMethod · 0.80
setLevelMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected