diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-05-25 10:20:34 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-05-25 10:20:34 (GMT) |
commit | 3b84eae03ebd8122fdbdced3d85999dd9aedfc7e (patch) | |
tree | 24214ca8e3ee6c15881dc8df29e94438ad9140b0 /Lib/test/test_logging.py | |
parent | e08b583d8828adefa6fba097a5c1405d78dbc759 (diff) | |
download | cpython-3b84eae03ebd8122fdbdced3d85999dd9aedfc7e.zip cpython-3b84eae03ebd8122fdbdced3d85999dd9aedfc7e.tar.gz cpython-3b84eae03ebd8122fdbdced3d85999dd9aedfc7e.tar.bz2 |
Closes #18046: Simplified logging internals relating to levels and their names. Thanks to Alex Gaynor for the patch.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r-- | Lib/test/test_logging.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index edb1c63..aa878da 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -94,7 +94,8 @@ class BaseTest(unittest.TestCase): self.saved_handlers = logging._handlers.copy() self.saved_handler_list = logging._handlerList[:] self.saved_loggers = saved_loggers = logger_dict.copy() - self.saved_level_names = logging._levelNames.copy() + self.saved_name_to_level = logging._nameToLevel.copy() + self.saved_level_to_name = logging._levelToName.copy() self.logger_states = logger_states = {} for name in saved_loggers: logger_states[name] = getattr(saved_loggers[name], @@ -136,8 +137,10 @@ class BaseTest(unittest.TestCase): self.root_logger.setLevel(self.original_logging_level) logging._acquireLock() try: - logging._levelNames.clear() - logging._levelNames.update(self.saved_level_names) + logging._levelToName.clear() + logging._levelToName.update(self.saved_level_to_name) + logging._nameToLevel.clear() + logging._nameToLevel.update(self.saved_name_to_level) logging._handlers.clear() logging._handlers.update(self.saved_handlers) logging._handlerList[:] = self.saved_handler_list |