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/bsddb | |
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/bsddb')
-rw-r--r-- | Lib/bsddb/test/test_1413192.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/bsddb/test/test_1413192.py b/Lib/bsddb/test/test_1413192.py index e8e73a1..c5d0036 100644 --- a/Lib/bsddb/test/test_1413192.py +++ b/Lib/bsddb/test/test_1413192.py @@ -5,7 +5,9 @@ import shutil import tempfile +from test.test_support import catch_warning import warnings + try: # For Pythons w/distutils and add-on pybsddb from bsddb3 import db @@ -33,12 +35,11 @@ class Context: del self.the_txn -warnings.filterwarnings('ignore', 'DBTxn aborted in destructor') -try: +with catch_warning(): + warnings.filterwarnings('ignore', 'DBTxn aborted in destructor') context = Context() del context -finally: - warnings.resetwarnings() + # try not to leave a turd try: |