(self)
| 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 | |
| 2264 | class EncodingTest(BaseTest): |
nothing calls this directly
no test coverage detected