summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-04-16 01:27:44 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-04-16 01:27:44 (GMT)
commitd392506c43a48d570a09a15e7f1889873fe17d6c (patch)
tree83ceeade55a3a7b201f7bcafe3a0804b85ad3c3c /Lib
parent50ac30ee0190ea2dd4ede87d63d6ebba23bd3a11 (diff)
downloadcpython-d392506c43a48d570a09a15e7f1889873fe17d6c.zip
cpython-d392506c43a48d570a09a15e7f1889873fe17d6c.tar.gz
cpython-d392506c43a48d570a09a15e7f1889873fe17d6c.tar.bz2
Tighten up some warning filters, and break some dependencies on the
order in which the tests are normally run.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test___all__.py9
-rw-r--r--Lib/test/test_coercion.py3
-rw-r--r--Lib/test/test_exceptions.py8
-rw-r--r--Lib/test/test_os.py4
-rw-r--r--Lib/test/test_regex.py2
-rw-r--r--Lib/test/test_repr.py10
-rw-r--r--Lib/test/test_strop.py5
-rw-r--r--Lib/test/test_sundry.py7
-rw-r--r--Lib/test/test_xmllib.py2
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):
'<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):
diff --git a/Lib/test/test_strop.py b/Lib/test/test_strop.py
index e26f08f..1e3feba 100644
--- a/Lib/test/test_strop.py
+++ b/Lib/test/test_strop.py
@@ -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
diff --git a/Lib/test/test_sundry.py b/Lib/test/test_sundry.py
index 86c7f7a..bd33b82 100644
--- a/Lib/test/test_sundry.py
+++ b/Lib/test/test_sundry.py
@@ -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
diff --git a/Lib/test/test_xmllib.py b/Lib/test/test_xmllib.py
index 1284a2c..afccfd8 100644
--- a/Lib/test/test_xmllib.py
+++ b/Lib/test/test_xmllib.py
@@ -15,7 +15,7 @@ testdoc = """\
import warnings
warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*",
- DeprecationWarning)
+ DeprecationWarning, r'xmllib$')
import test_support
import unittest