summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-05-08 20:20:24 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-05-08 20:20:24 (GMT)
commit5d023c3afacf4af2bcaedcb63305a36e179f0236 (patch)
treedf761a625592f945d24dea4e9231ecb09d1245b6 /Lib/test/test_support.py
parent6071cc8fb027d4b7163742d578a1b8666afe1d1c (diff)
downloadcpython-5d023c3afacf4af2bcaedcb63305a36e179f0236.zip
cpython-5d023c3afacf4af2bcaedcb63305a36e179f0236.tar.gz
cpython-5d023c3afacf4af2bcaedcb63305a36e179f0236.tar.bz2
Fix a bug introduced by the addition of the 'record' argument to
test.test_support.catch_warning() where showwarning() was not being set properly.
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r--Lib/test/test_support.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 25494a9..9a45fdd 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -406,11 +406,11 @@ def catch_warning(module=warnings, record=True):
warnings.warn("foo")
assert str(w.message) == "foo"
"""
+ original_filters = module.filters[:]
+ original_showwarning = module.showwarning
if record:
warning_obj = WarningMessage()
module.showwarning = warning_obj._showwarning
- original_filters = module.filters[:]
- original_showwarning = module.showwarning
try:
yield warning_obj if record else None
finally: