Make sure that the warnings filter is not reset or changed beyond the current

running test file.

Closes issue2407. Thanks Jerry Seutter.
This commit is contained in:
Brett Cannon 2008-03-19 23:01:17 +00:00
parent a0ce6b6b71
commit 48581c5f08
3 changed files with 24 additions and 36 deletions

View file

@ -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()