diff options
author | Greg Ward <gward@python.net> | 2005-03-07 01:10:33 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2005-03-07 01:10:33 (GMT) |
commit | 605db0d8c5e25bbfe205baa3210f0dc73825ffa9 (patch) | |
tree | 49a68db656e26743faf8189331e5a02f219d5db9 /Lib | |
parent | 22ef9a1228545db2dbdb0d4704393987f40afbfd (diff) | |
download | cpython-605db0d8c5e25bbfe205baa3210f0dc73825ffa9.zip cpython-605db0d8c5e25bbfe205baa3210f0dc73825ffa9.tar.gz cpython-605db0d8c5e25bbfe205baa3210f0dc73825ffa9.tar.bz2 |
Ensure that warnings.filters is properly restored after fiddling with it
(this was breaking test_warnings).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_descr.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 4af59b0..1601e4d 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3973,15 +3973,18 @@ def test_init(): def __init__(self): return 10 - oldfilters = warnings.filters - warnings.filterwarnings("error", category=RuntimeWarning) + oldfilters = warnings.filters[:] try: - Foo() - except RuntimeWarning: pass - else: - raise TestFailed, "did not test __init__() for None return" - warnings.filters = oldfilters + warnings.filterwarnings("error", category=RuntimeWarning) + try: + Foo() + except RuntimeWarning: + pass + else: + raise TestFailed, "did not test __init__() for None return" + finally: + warnings.filters = oldfilters def test_main(): |