diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-07-21 19:39:26 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-07-21 19:39:26 (GMT) |
commit | 750eae1bd4a25dc1d3895b4757d22a6acf262ae9 (patch) | |
tree | 7c1d51d851b80620a8847602cdd5f17ce62ba1a5 /Lib/test/test_logging.py | |
parent | 19c1a8725ca21882fff8d24891de3f9ff24458ba (diff) | |
download | cpython-750eae1bd4a25dc1d3895b4757d22a6acf262ae9.zip cpython-750eae1bd4a25dc1d3895b4757d22a6acf262ae9.tar.gz cpython-750eae1bd4a25dc1d3895b4757d22a6acf262ae9.tar.bz2 |
Issue #24678: Fixed raiseExceptions typo in logging tests.
Patch by Jacek KoĆodziej.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r-- | Lib/test/test_logging.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 8770e1b..ddab2e0 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -41,7 +41,8 @@ import sys import tempfile from test.script_helper import assert_python_ok from test.support import (captured_stdout, run_with_locale, run_unittest, - patch, requires_zlib, TestHandler, Matcher, HOST) + patch, requires_zlib, TestHandler, Matcher, HOST, + swap_attr) import textwrap import time import unittest @@ -3748,18 +3749,12 @@ class LoggerTest(BaseTest): (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 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 swap_attr(logging, 'raiseExceptions', False): + self.logger.log('10', 'test message') # no exception happens def test_find_caller_with_stack_info(self): called = [] |