From d392506c43a48d570a09a15e7f1889873fe17d6c Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 16 Apr 2002 01:27:44 +0000 Subject: Tighten up some warning filters, and break some dependencies on the order in which the tests are normally run. --- Lib/test/test___all__.py | 9 ++++++--- Lib/test/test_coercion.py | 3 ++- Lib/test/test_exceptions.py | 8 ++++++-- Lib/test/test_os.py | 4 ++-- Lib/test/test_regex.py | 2 +- Lib/test/test_repr.py | 10 +++++++--- Lib/test/test_strop.py | 5 +++-- Lib/test/test_sundry.py | 7 ++++++- Lib/test/test_xmllib.py | 2 +- 9 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index 299054f..01c918c 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -2,9 +2,12 @@ from test_support import verify, verbose import sys import warnings -warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning) -warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning) -warnings.filterwarnings("ignore", ".* statcache .*", DeprecationWarning) +warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning, + r'pre$') +warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning, + r'^regsub$') +warnings.filterwarnings("ignore", ".* statcache .*", DeprecationWarning, + r'statcache$') def check_all(modname): names = {} diff --git a/Lib/test/test_coercion.py b/Lib/test/test_coercion.py index 4be762e..afade35 100644 --- a/Lib/test/test_coercion.py +++ b/Lib/test/test_coercion.py @@ -112,6 +112,7 @@ def do_prefix_binops(): warnings.filterwarnings("ignore", r'complex divmod\(\), // and % are deprecated', - DeprecationWarning) + DeprecationWarning, + r'test_coercion$') do_infix_binops() do_prefix_binops() diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index e03abfa..c2fbec6 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -5,8 +5,6 @@ from types import ClassType import warnings import sys, traceback -warnings.filterwarnings("error", "", OverflowWarning, __name__) - print '5. Built-in exceptions' # XXX This is not really enough, each *operation* should be tested! @@ -86,6 +84,12 @@ try: x = undefined_variable except NameError: pass r(OverflowError) +# XXX +# Obscure: this test relies on int+int raising OverflowError if the +# ints are big enough. But ints no longer do that by default. This +# test will have to go away someday. For now, we can convert the +# transitional OverflowWarning into an error. +warnings.filterwarnings("error", "", OverflowWarning, __name__) x = 1 try: while 1: x = x+x diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index ae3bcc3..12c016b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -33,7 +33,7 @@ class TemporaryFileTests(unittest.TestCase): if not hasattr(os, "tempnam"): return warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, - "test_os") + r"test_os$") self.check_tempfile(os.tempnam()) name = os.tempnam(TESTFN) @@ -57,7 +57,7 @@ class TemporaryFileTests(unittest.TestCase): if not hasattr(os, "tmpnam"): return warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, - "test_os") + r"test_os$") self.check_tempfile(os.tmpnam()) # Test attributes on return values from os.*stat* family. diff --git a/Lib/test/test_regex.py b/Lib/test/test_regex.py index b6260d2..0fe82b7 100644 --- a/Lib/test/test_regex.py +++ b/Lib/test/test_regex.py @@ -1,7 +1,7 @@ from test_support import verbose, sortdict import warnings warnings.filterwarnings("ignore", "the regex module is deprecated", - DeprecationWarning, __name__) + DeprecationWarning, r'test_regex$') import regex from regex_syntax import * diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py index 89df890..1d7ea85 100644 --- a/Lib/test/test_repr.py +++ b/Lib/test/test_repr.py @@ -105,14 +105,18 @@ class ReprTests(unittest.TestCase): '