[Python-checkins] cpython (merge 3.4 -> 3.5): Issue #24678: Fixed raiseExceptions typo in logging tests.

serhiy.storchaka python-checkins at python.org
Tue Jul 21 21:42:00 CEST 2015


https://hg.python.org/cpython/rev/7a54e400155f
changeset:   96980:7a54e400155f
branch:      3.5
parent:      96977:f02c5bf59fbb
parent:      96979:20e2b980bb87
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Jul 21 22:40:18 2015 +0300
summary:
  Issue #24678: Fixed raiseExceptions typo in logging tests.
Patch by Jacek Kołodziej.

files:
  Lib/test/test_logging.py |  14 ++++----------
  1 files changed, 4 insertions(+), 10 deletions(-)


diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3779,18 +3779,12 @@
                          (exc.__class__, exc, exc.__traceback__))
 
     def test_log_invalid_level_with_raise(self):
-        old_raise = logging.raiseExceptions
-        self.addCleanup(setattr, logging, 'raiseExecptions', old_raise)
-
-        logging.raiseExceptions = True
-        self.assertRaises(TypeError, self.logger.log, '10', 'test message')
+        with support.swap_attr(logging, 'raiseExceptions', True):
+            self.assertRaises(TypeError, self.logger.log, '10', 'test message')
 
     def test_log_invalid_level_no_raise(self):
-        old_raise = logging.raiseExceptions
-        self.addCleanup(setattr, logging, 'raiseExecptions', old_raise)
-
-        logging.raiseExceptions = False
-        self.logger.log('10', 'test message')  # no exception happens
+        with support.swap_attr(logging, 'raiseExceptions', False):
+            self.logger.log('10', 'test message')  # no exception happens
 
     def test_find_caller_with_stack_info(self):
         called = []

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list