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 6c18715..c57ac7f 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('a', '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()