[Python-Dev] Failing tests: marshal, warnings
Brett C.
bac at OCF.Berkeley.EDU
Mon Mar 7 02:14:22 CET 2005
Greg Ward wrote:
[SNIP]
> A-ha! I get it. There are two mistakes in test_descr.py:test_init():
> lack of "finally" clause, and failure to make a copy of
> warnings.filters. This patch fixes both:
>
> """
> --- Lib/test/test_descr.py 4 Mar 2005 04:47:04 -0000 1.202.2.2
> +++ Lib/test/test_descr.py 7 Mar 2005 00:54:00 -0000
> @@ -3973,15 +3973,18 @@
> 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():
> """
>
> I'll check this in and merge to the trunk once I see all tests passing.
>
Well, I just checked in the list copy fix, so you only have to worry about
adding the 'finally' clause to the 'try' statement.
-Brett
More information about the Python-Dev
mailing list