MCPcopy Create free account
hub / github.com/RustPython/RustPython / test_persistent_loggers

Method test_persistent_loggers

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

Source from the content-addressed store, hash-verified

2238 "but have been destroyed: %s" % (len(dead), ", ".join(dead)))
2239
2240 def test_persistent_loggers(self):
2241 # Logger objects are persistent and retain their configuration, even
2242 # if visible references are destroyed.
2243 self.root_logger.setLevel(logging.INFO)
2244 foo = logging.getLogger("foo")
2245 self._watch_for_survival(foo)
2246 foo.setLevel(logging.DEBUG)
2247 self.root_logger.debug(self.next_message())
2248 foo.debug(self.next_message())
2249 self.assert_log_lines([
2250 ('foo', 'DEBUG', '2'),
2251 ])
2252 del foo
2253 # foo has survived.
2254 self._assertTruesurvival()
2255 # foo has retained its settings.
2256 bar = logging.getLogger("foo")
2257 bar.debug(self.next_message())
2258 self.assert_log_lines([
2259 ('foo', 'DEBUG', '2'),
2260 ('foo', 'DEBUG', '3'),
2261 ])
2262
2263
2264class 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