summaryrefslogtreecommitdiff
path: root/Lib/bsddb
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-03-19 23:01:17 +0000
committerBrett Cannon <bcannon@gmail.com>2008-03-19 23:01:17 +0000
commit69cd35f7614431ba077ca390326890665cc22f0d (patch)
tree4fb926a2dbea9814d69ebac572c363be9df7a592 /Lib/bsddb
parent8ac823516b6be62f48c0f1fa5af8e3e71844190f (diff)
downloadcpython-69cd35f7614431ba077ca390326890665cc22f0d.tar.gz
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.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/bsddb/test/test_1413192.py b/Lib/bsddb/test/test_1413192.py
index e8e73a160d..c5d0036892 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: