summaryrefslogtreecommitdiffstats
path: root/Lib/packaging/tests
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-24 11:59:21 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-24 11:59:21 (GMT)
commit79d1b1ce3fdfd6f62d77f6096e1bc61ee2170cdf (patch)
tree80dc501479048cda8ade38e6dc8d3ae77edf1f43 /Lib/packaging/tests
parent99c8b1614319ce0161835ade223cdd395f0126d4 (diff)
downloadcpython-79d1b1ce3fdfd6f62d77f6096e1bc61ee2170cdf.zip
cpython-79d1b1ce3fdfd6f62d77f6096e1bc61ee2170cdf.tar.gz
cpython-79d1b1ce3fdfd6f62d77f6096e1bc61ee2170cdf.tar.bz2
Issue #12167: packaging.tests.support, LoggingCatcher restores correctly the
log level. Avoid also calls to .addCleanup() in setUp().
Diffstat (limited to 'Lib/packaging/tests')
-rw-r--r--Lib/packaging/tests/support.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/packaging/tests/support.py b/Lib/packaging/tests/support.py
index 0c85b5d..6d60b9e 100644
--- a/Lib/packaging/tests/support.py
+++ b/Lib/packaging/tests/support.py
@@ -71,8 +71,8 @@ class LoggingCatcher:
def setUp(self):
super(LoggingCatcher, self).setUp()
self.loghandler = handler = _TestHandler()
+ self.old_level = logger.level
logger.addHandler(handler)
- self.addCleanup(logger.setLevel, logger.level)
logger.setLevel(logging.DEBUG) # we want all messages
def tearDown(self):
@@ -84,6 +84,7 @@ class LoggingCatcher:
for ref in weakref.getweakrefs(handler):
logging._removeHandlerRef(ref)
del self.loghandler
+ logger.setLevel(self.old_level)
super(LoggingCatcher, self).tearDown()
def get_logs(self, *levels):