On 06 March 2005, I said: > OK, I've narrowed it down: test_warnings fails when run after > test_descr:
Raymond Hettinger, step right up! You're the next contestant on The Tests Are Failing! Your recent checkins include... working file: Lib/test/test_descr.py; sticky tag: release24-maint revision: 1.202.2.1 date: 2005/03/03 16:55:53; author: rhettinger; lines: +13 -0 SF bug #1155938: Missing None check for __init__(). ---------------------------- revision: 1.202.2.2 date: 2005/03/04 04:47:04; author: rhettinger; lines: +7 -1 Convert "__init__ should return None" from an exception to a warning. If I revert test_descr.py to 1.202 (the branch point for 2.4), then running ./python -E Lib/test/regrtest.py test_descr test_warnings works just fine. If I revert to 1.202.2.1, then test_descr fails, but test_warnings passes. If I update to the latest, 1.202.2.2, then test_desc passes, but test_warnings fails. [...a few minutes of tinkering and reading up on warning filters...] 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. Greg -- Greg Ward <[EMAIL PROTECTED]> http://www.gerg.ca/ I hope something GOOD came in the mail today so I have a REASON to live!! _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com