summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_hmac.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_hmac.py')
-rw-r--r--Lib/test/test_hmac.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
index d8c03db..537f298 100644
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -211,8 +211,8 @@ class TestVectorsTestCase(unittest.TestCase):
def digest(self):
return self._x.digest()
- warnings.simplefilter('error', RuntimeWarning)
- try:
+ with test_support.catch_warning():
+ warnings.simplefilter('error', RuntimeWarning)
try:
hmac.HMAC(b'a', b'b', digestmod=MockCrazyHash)
except RuntimeWarning:
@@ -227,8 +227,6 @@ class TestVectorsTestCase(unittest.TestCase):
pass
else:
self.fail('Expected warning about small block_size')
- finally:
- warnings.resetwarnings()