Kaydet (Commit) d392506c authored tarafından Tim Peters's avatar Tim Peters

Tighten up some warning filters, and break some dependencies on the

order in which the tests are normally run.
üst 50ac30ee
......@@ -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 = {}
......
......@@ -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()
......@@ -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
......
......@@ -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.
......
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 *
......
......@@ -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):
......
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
......
"""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
......
......@@ -15,7 +15,7 @@ testdoc = """\
import warnings
warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*",
DeprecationWarning)
DeprecationWarning, r'xmllib$')
import test_support
import unittest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment