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