]> granicus.if.org Git - python/commitdiff
Tighten up some warning filters, and break some dependencies on the
authorTim Peters <tim.peters@gmail.com>
Tue, 16 Apr 2002 01:27:44 +0000 (01:27 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 16 Apr 2002 01:27:44 +0000 (01:27 +0000)
order in which the tests are normally run.

Lib/test/test___all__.py
Lib/test/test_coercion.py
Lib/test/test_exceptions.py
Lib/test/test_os.py
Lib/test/test_regex.py
Lib/test/test_repr.py
Lib/test/test_strop.py
Lib/test/test_sundry.py
Lib/test/test_xmllib.py

index 299054f838763945ef6aabaf3bbd14b9ca660041..01c918cdc100b15cd75fa495442585b600197112 100644 (file)
@@ -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 = {}
index 4be762e0e44f1ee0ee5ee593612adf1bf4a852cb..afade35287e562d1ff8ae52f4387ef6fb398d7a5 100644 (file)
@@ -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()
index e03abfa10e9ce35275e70f73ec1a387056154d3c..c2fbec6dee9222b07dae6a8abf61fc6dc6e83458 100644 (file)
@@ -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
index ae3bcc3f4ea42b0e376c3d98b3802ae2bf37dc71..12c016b4c6a25ba7d36f820547cb7070bd6f9d46 100644 (file)
@@ -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.
index b6260d264e4ad8d062692af56c6797482217ddf1..0fe82b7f1de410611faaa10a09bb16f19cb4ab56 100644 (file)
@@ -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 *
 
index 89df890fd105b4d423a3264ef64bb46445b993f7..1d7ea856d08226010aa009b82297d18bc44357de 100644 (file)
@@ -105,14 +105,18 @@ class ReprTests(unittest.TestCase):
             '<built-in method split of str object at 0x'))
 
     def test_xrange(self):
+        import warnings
         eq = self.assertEquals
         eq(repr(xrange(1)), 'xrange(1)')
         eq(repr(xrange(1, 2)), 'xrange(1, 2)')
         eq(repr(xrange(1, 2, 3)), 'xrange(1, 4, 3)')
         # Turn off warnings for deprecated multiplication
-        import warnings
-        warnings.filterwarnings('ignore', category=DeprecationWarning,
-                                module=ReprTests.__module__)
+        warnings.filterwarnings('ignore',
+                 r'xrange object multiplication is deprecated',
+                 DeprecationWarning, module=ReprTests.__module__)
+        warnings.filterwarnings('ignore',
+                 r"PyRange_New's 'repetitions' argument is deprecated",
+                 DeprecationWarning, module=ReprTests.__module__)
         eq(repr(xrange(1) * 3), '(xrange(1) * 3)')
 
     def test_nesting(self):
index e26f08fc94f8d57fabcc4b7159842e12ed1cc6d0..1e3febab0600f8854931551ad191877df227f30c 100644 (file)
@@ -1,6 +1,7 @@
 import warnings
-warnings.filterwarnings("ignore", "", DeprecationWarning, __name__)
-warnings.filterwarnings("ignore", "", DeprecationWarning, "unittest")
+warnings.filterwarnings("ignore", "strop functions are obsolete;",
+                        DeprecationWarning,
+                        r'test_strop|unittest')
 import strop
 import test_support
 import unittest
index 86c7f7a69366ff07e45841d7abd515b494e714fa..bd33b82c282b18541d95262a9f75e0d44f8a6758 100644 (file)
@@ -1,7 +1,12 @@
 """Do a minimal test of all the modules that aren't otherwise tested."""
 
 import warnings
-warnings.filterwarnings('ignore', '', DeprecationWarning, 'posixfile')
+warnings.filterwarnings('ignore', r".*posixfile module",
+                        DeprecationWarning, 'posixfile$')
+warnings.filterwarnings('ignore', r".*statcache module",
+                        DeprecationWarning, 'statcache$')
+warnings.filterwarnings('ignore', r".*'re' module",
+                        DeprecationWarning, 'pre$')
 
 from test_support import verbose
 
index 1284a2c95e926f064a8c1a52b91964495e07ca4b..afccfd887c4d054555c3e9143226531b6979b298 100644 (file)
@@ -15,7 +15,7 @@ testdoc = """\
 
 import warnings
 warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*",
-                        DeprecationWarning)
+                        DeprecationWarning, r'xmllib$')
 
 import test_support
 import unittest