diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-03-19 23:01:17 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-03-19 23:01:17 (GMT) |
commit | 48581c5f08d368942840f99687fce7f10758fa7c (patch) | |
tree | 14cc33ca66d541c3b8bae9643cc29682e841e13e /Lib/test/test_hmac.py | |
parent | a0ce6b6b7123378f0a13bd3b9dfd9eb9eeea2eb2 (diff) | |
download | cpython-48581c5f08d368942840f99687fce7f10758fa7c.zip cpython-48581c5f08d368942840f99687fce7f10758fa7c.tar.gz cpython-48581c5f08d368942840f99687fce7f10758fa7c.tar.bz2 |
Make sure that the warnings filter is not reset or changed beyond the current
running test file.
Closes issue2407. Thanks Jerry Seutter.
Diffstat (limited to 'Lib/test/test_hmac.py')
-rw-r--r-- | Lib/test/test_hmac.py | 6 |
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() |