From f022a4d451d1d91d3462a7508b0bda8ef3d7ff24 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Mon, 15 Apr 2002 23:52:04 +0000 Subject: [PATCH] Reduce the number of test-suite DeprecationWarnings; start adding resetwarnings() calls too. --- Lib/test/test___all__.py | 2 ++ Lib/test/test_coercion.py | 11 +++++++++-- Lib/test/test_xmllib.py | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index 299054f8387..2890066f135 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -158,3 +158,5 @@ check_all("weakref") check_all("webbrowser") check_all("xdrlib") check_all("zipfile") + +warnings.resetwarnings() diff --git a/Lib/test/test_coercion.py b/Lib/test/test_coercion.py index d39e6fd046e..6c0ee7b18be 100644 --- a/Lib/test/test_coercion.py +++ b/Lib/test/test_coercion.py @@ -1,5 +1,6 @@ import copy import sys +import warnings # Fake a number that implements numeric methods through __coerce__ class CoerceNumber: @@ -109,5 +110,11 @@ def do_prefix_binops(): else: print '=', x -do_infix_binops() -do_prefix_binops() +warnings.filterwarnings("ignore", + r'complex divmod\(\), // and % are deprecated', + DeprecationWarning) +try: + do_infix_binops() + do_prefix_binops() +finally: + warnings.resetwarnings() diff --git a/Lib/test/test_xmllib.py b/Lib/test/test_xmllib.py index 97ae1411017..6756b643744 100644 --- a/Lib/test/test_xmllib.py +++ b/Lib/test/test_xmllib.py @@ -16,7 +16,6 @@ testdoc = """\ import warnings warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", DeprecationWarning) -del warnings import test_support import unittest @@ -33,6 +32,7 @@ class XMLParserTestCase(unittest.TestCase): def test_main(): test_support.run_unittest(XMLParserTestCase) + warnings.resetwarnings() if __name__ == "__main__":