Index: Lib/test/list_tests.py =================================================================== --- Lib/test/list_tests.py (revision 77822) +++ Lib/test/list_tests.py (working copy) @@ -36,7 +36,7 @@ self.assertEqual(str(a0), str(l0)) self.assertEqual(repr(a0), repr(l0)) - self.assertEqual(`a2`, `l2`) + self.assertEqual(repr(a2), repr(l2)) self.assertEqual(str(a2), "[0, 1, 2]") self.assertEqual(repr(a2), "[0, 1, 2]") @@ -421,6 +421,11 @@ self.assertRaises(TypeError, u.reverse, 42) def test_sort(self): + with test_support.silence_py3k_warnings( + ("the cmp argument is not supported", DeprecationWarning)): + self._test_sort() + + def _test_sort(self): u = self.type2test([1, 0]) u.sort() self.assertEqual(u, [0, 1]) Index: Lib/test/test_array.py =================================================================== --- Lib/test/test_array.py (revision 77822) +++ Lib/test/test_array.py (working copy) @@ -749,7 +749,8 @@ def test_buffer(self): a = array.array(self.typecode, self.example) - b = buffer(a) + with test_support.silence_py3k_warnings(): + b = buffer(a) self.assertEqual(b[0], a.tostring()[0]) def test_weakref(self): Index: Lib/test/test_ast.py =================================================================== --- Lib/test/test_ast.py (revision 77822) +++ Lib/test/test_ast.py (working copy) @@ -1,6 +1,7 @@ import sys, itertools, unittest from test import test_support import ast +import warnings def to_tuple(t): if t is None or isinstance(t, (basestring, int, long, complex)): @@ -302,7 +303,9 @@ def test_main(): - test_support.run_unittest(AST_Tests, ASTHelpers_Test) + with test_support.silence_py3k_warnings(("backquote not supported", + SyntaxWarning)): + test_support.run_unittest(AST_Tests, ASTHelpers_Test) def main(): if __name__ != '__main__': Index: Lib/test/test_augassign.py =================================================================== --- Lib/test/test_augassign.py (revision 77822) +++ Lib/test/test_augassign.py (working copy) @@ -1,6 +1,6 @@ # Augmented assignment test. -from test.test_support import run_unittest +from test.test_support import run_unittest, silence_py3k_warnings import unittest @@ -324,7 +324,8 @@ '''.splitlines()) def test_main(): - run_unittest(AugAssignTest) + with silence_py3k_warnings(("classic int division", DeprecationWarning)): + run_unittest(AugAssignTest) if __name__ == '__main__': test_main() Index: Lib/test/test_buffer.py =================================================================== --- Lib/test/test_buffer.py (revision 77822) +++ Lib/test/test_buffer.py (working copy) @@ -23,7 +23,9 @@ def test_main(): - test_support.run_unittest(BufferTests) + with test_support.silence_py3k_warnings(("buffer.. not supported", + DeprecationWarning)): + test_support.run_unittest(BufferTests) if __name__ == "__main__": test_main() Index: Lib/test/test_builtin.py =================================================================== --- Lib/test/test_builtin.py (revision 77822) +++ Lib/test/test_builtin.py (working copy) @@ -3,14 +3,11 @@ import platform import test.test_support, unittest from test.test_support import fcmp, have_unicode, TESTFN, unlink, \ - run_unittest, run_with_locale + run_unittest, run_with_locale, \ + silence_py3k_warnings from operator import neg -import sys, warnings, cStringIO, random, fractions, UserDict -warnings.filterwarnings("ignore", "hex../oct.. of negative int", - FutureWarning, __name__) -warnings.filterwarnings("ignore", "integer argument expected", - DeprecationWarning, "unittest") +import sys, cStringIO, random, fractions, UserDict # count the number of test runs. # used to skip running test_execfile() multiple times @@ -419,7 +416,9 @@ f.write('z = z+1\n') f.write('z = z*2\n') f.close() - execfile(TESTFN) + with silence_py3k_warnings((".+ not supported in 3.x", + DeprecationWarning)): + execfile(TESTFN) def test_execfile(self): global numruns @@ -1542,17 +1541,25 @@ data = 'The quick Brown fox Jumped over The lazy Dog'.split() self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0) +def _run_unittest(*args): + with silence_py3k_warnings( + (".+ not supported in 3.x", DeprecationWarning), + (".+ is renamed to imp.reload", DeprecationWarning), + ("integer argument expected, got float", DeprecationWarning), + ("classic int division", DeprecationWarning)): + run_unittest(*args) + def test_main(verbose=None): test_classes = (BuiltinTest, TestSorted) - run_unittest(*test_classes) + _run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - run_unittest(*test_classes) + _run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_class.py =================================================================== --- Lib/test/test_class.py (revision 77822) +++ Lib/test/test_class.py (working copy) @@ -407,7 +407,7 @@ self.assertCallStack([("__coerce__", (testme, 1)), ('__cmp__', (testme, 1))]) callLst[:] = [] - testme <> 1 # XXX kill this in py3k + eval('testme <> 1') # XXX kill this in py3k self.assertCallStack([("__coerce__", (testme, 1)), ('__cmp__', (testme, 1))]) callLst[:] = [] @@ -427,7 +427,7 @@ self.assertCallStack([("__coerce__", (testme, 1)), ('__cmp__', (1, testme))]) callLst[:] = [] - 1 <> testme + eval('1 <> testme') self.assertCallStack([("__coerce__", (testme, 1)), ('__cmp__', (1, testme))]) callLst[:] = [] @@ -616,7 +616,11 @@ hash(a.f) def test_main(): - test_support.run_unittest(ClassTests) + with test_support.silence_py3k_warnings( + (".+slice__ has been removed", DeprecationWarning), + ("classic int division", DeprecationWarning), + ("<> not supported", DeprecationWarning)): + test_support.run_unittest(ClassTests) if __name__=='__main__': test_main() Index: Lib/test/test_compile.py =================================================================== --- Lib/test/test_compile.py (revision 77822) +++ Lib/test/test_compile.py (working copy) @@ -2,6 +2,7 @@ import sys import _ast from test import test_support +import textwrap class TestSpecifics(unittest.TestCase): @@ -142,6 +143,9 @@ def test_complex_args(self): + with test_support.silence_py3k_warnings( + ("tuple parameter unpacking has been removed", SyntaxWarning)): + exec textwrap.dedent(''' def comp_args((a, b)): return a,b self.assertEqual(comp_args((1, 2)), (1, 2)) @@ -159,6 +163,7 @@ return a, b, c self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) self.assertEqual(comp_args(), (2, 3, 4)) + ''') def test_argument_order(self): try: Index: Lib/test/test_complex_args.py =================================================================== --- Lib/test/test_complex_args.py (revision 77822) +++ Lib/test/test_complex_args.py (working copy) @@ -1,23 +1,30 @@ import unittest from test import test_support +import textwrap class ComplexArgsTestCase(unittest.TestCase): def check(self, func, expected, *args): self.assertEqual(func(*args), expected) - # These functions are tested below as lambdas too. If you add a function test, - # also add a similar lambda test. + # These functions are tested below as lambdas too. If you add a + # function test, also add a similar lambda test. + + # Functions are wrapped in "exec" statements in order to + # silence Py3k warnings def test_func_parens_no_unpacking(self): + exec textwrap.dedent(""" def f(((((x))))): return x self.check(f, 1, 1) # Inner parens are elided, same as: f(x,) def f(((x)),): return x self.check(f, 2, 2) + """) def test_func_1(self): + exec textwrap.dedent(""" def f(((((x),)))): return x self.check(f, 3, (3,)) def f(((((x)),))): return x @@ -26,16 +33,22 @@ self.check(f, 5, (5,)) def f(((x),)): return x self.check(f, 6, (6,)) + """) def test_func_2(self): + exec textwrap.dedent(""" def f(((((x)),),)): return x self.check(f, 2, ((2,),)) + """) def test_func_3(self): + exec textwrap.dedent(""" def f((((((x)),),),)): return x self.check(f, 3, (((3,),),)) + """) def test_func_complex(self): + exec textwrap.dedent(""" def f((((((x)),),),), a, b, c): return x, a, b, c self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) @@ -44,18 +57,22 @@ def f(a, b, c, ((((((x)),)),),)): return a, b, c, x self.check(f, (9, 8, 7, 3), 9, 8, 7, (((3,),),)) + """) # Duplicate the tests above, but for lambda. If you add a lambda test, # also add a similar function test above. def test_lambda_parens_no_unpacking(self): + exec textwrap.dedent(""" f = lambda (((((x))))): x self.check(f, 1, 1) # Inner parens are elided, same as: f(x,) f = lambda ((x)),: x self.check(f, 2, 2) + """) def test_lambda_1(self): + exec textwrap.dedent(""" f = lambda (((((x),)))): x self.check(f, 3, (3,)) f = lambda (((((x)),))): x @@ -64,16 +81,22 @@ self.check(f, 5, (5,)) f = lambda (((x),)): x self.check(f, 6, (6,)) + """) def test_lambda_2(self): + exec textwrap.dedent(""" f = lambda (((((x)),),)): x self.check(f, 2, ((2,),)) + """) def test_lambda_3(self): + exec textwrap.dedent(""" f = lambda ((((((x)),),),)): x self.check(f, 3, (((3,),),)) + """) def test_lambda_complex(self): + exec textwrap.dedent(""" f = lambda (((((x)),),),), a, b, c: (x, a, b, c) self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) @@ -82,10 +105,14 @@ f = lambda a, b, c, ((((((x)),)),),): (a, b, c, x) self.check(f, (9, 8, 7, 3), 9, 8, 7, (((3,),),)) + """) def test_main(): - test_support.run_unittest(ComplexArgsTestCase) + with test_support.silence_py3k_warnings( + ("tuple parameter unpacking has been removed", SyntaxWarning), + ("parenthesized argument names are invalid", SyntaxWarning)): + test_support.run_unittest(ComplexArgsTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_ctypes.py =================================================================== --- Lib/test/test_ctypes.py (revision 77822) +++ Lib/test/test_ctypes.py (working copy) @@ -1,6 +1,6 @@ import unittest -from test.test_support import run_unittest, import_module +from test.test_support import run_unittest, import_module, silence_py3k_warnings #Skip tests if _ctypes module does not exist import_module('_ctypes') @@ -9,7 +9,9 @@ def test_main(): skipped, testcases = ctypes.test.get_tests(ctypes.test, "test_*.py", verbosity=0) suites = [unittest.makeSuite(t) for t in testcases] - run_unittest(unittest.TestSuite(suites)) + with silence_py3k_warnings(("buffer.. not supported", DeprecationWarning), + ("classic long division", DeprecationWarning)): + run_unittest(unittest.TestSuite(suites)) if __name__ == "__main__": test_main() Index: Lib/test/test_descr.py =================================================================== --- Lib/test/test_descr.py (revision 77822) +++ Lib/test/test_descr.py (working copy) @@ -4618,9 +4618,14 @@ def test_main(): - # Run all local test cases, with PTypesLongInitTest first. - test_support.run_unittest(PTypesLongInitTest, OperatorsTest, - ClassPropertiesAndMethods, DictProxyTests) + with test_support.silence_py3k_warnings( + ("classic .+ division", DeprecationWarning), + ("coerce.. not supported", DeprecationWarning), + ("Overriding __cmp__ ", DeprecationWarning), + (".+slice__ has been removed", DeprecationWarning)): + # Run all local test cases, with PTypesLongInitTest first. + test_support.run_unittest(PTypesLongInitTest, OperatorsTest, + ClassPropertiesAndMethods, DictProxyTests) if __name__ == "__main__": test_main() Index: Lib/test/test_doctest.py =================================================================== --- Lib/test/test_doctest.py (revision 77822) +++ Lib/test/test_doctest.py (working copy) @@ -2421,7 +2421,10 @@ test_support.run_doctest(doctest, verbosity=True) # Check the doctest cases defined here: from test import test_doctest - test_support.run_doctest(test_doctest, verbosity=True) + with test_support.silence_py3k_warnings( + ("backquote not supported", SyntaxWarning), + ("execfile.. not supported", DeprecationWarning)): + test_support.run_doctest(test_doctest, verbosity=True) import trace, sys def test_coverage(coverdir): Index: Lib/test/test_grammar.py =================================================================== --- Lib/test/test_grammar.py (revision 77822) +++ Lib/test/test_grammar.py (working copy) @@ -8,7 +8,8 @@ # regression test, the filterwarnings() call has been added to # regrtest.py. -from test.test_support import run_unittest, check_syntax_error +from test.test_support import run_unittest, check_syntax_error, \ + silence_py3k_warnings import unittest import sys # testing import * @@ -152,8 +153,9 @@ f1(*(), **{}) def f2(one_argument): pass def f3(two, arguments): pass - def f4(two, (compound, (argument, list))): pass - def f5((compound, first), two): pass + # Silence Py3k warning + exec('def f4(two, (compound, (argument, list))): pass') + exec('def f5((compound, first), two): pass') self.assertEquals(f2.func_code.co_varnames, ('one_argument',)) self.assertEquals(f3.func_code.co_varnames, ('two', 'arguments')) if sys.platform.startswith('java'): @@ -172,7 +174,8 @@ def v0(*rest): pass def v1(a, *rest): pass def v2(a, b, *rest): pass - def v3(a, (b, c), *rest): return a, b, c, rest + # Silence Py3k warning + exec('def v3(a, (b, c), *rest): return a, b, c, rest') f1() f2(1) @@ -277,9 +280,10 @@ d22v(*(1, 2, 3, 4)) d22v(1, 2, *(3, 4, 5)) d22v(1, *(2, 3), **{'d': 4}) - def d31v((x)): pass + # Silence Py3k warning + exec('def d31v((x)): pass') + exec('def d32v((x,)): pass') d31v(1) - def d32v((x,)): pass d32v((1,)) # keyword arguments after *arglist @@ -474,7 +478,7 @@ continue except: raise - if count > 2 or big_hippo <> 1: + if count > 2 or big_hippo != 1: self.fail("continue then break in try/except in loop broken!") test_inner() @@ -677,7 +681,6 @@ x = (1 == 1) if 1 == 1: pass if 1 != 1: pass - if 1 <> 1: pass if 1 < 1: pass if 1 > 1: pass if 1 <= 1: pass @@ -686,7 +689,10 @@ if 1 is not 1: pass if 1 in (): pass if 1 not in (): pass - if 1 < 1 > 1 == 1 >= 1 <= 1 <> 1 != 1 in 1 not in 1 is 1 is not 1: pass + if 1 < 1 > 1 == 1 >= 1 <= 1 != 1 in 1 not in 1 is 1 is not 1: pass + # Silence Py3k warning + if eval('1 <> 1'): pass + if eval('1 < 1 > 1 == 1 >= 1 <= 1 <> 1 != 1 in 1 not in 1 is 1 is not 1'): pass def testBinaryMaskOps(self): x = 1 & 1 @@ -774,9 +780,10 @@ x = {'one', 'two', 'three'} x = {2, 3, 4,} - x = `x` - x = `1 or 2 or 3` - self.assertEqual(`1,2`, '(1, 2)') + # Silence Py3k warning + x = eval('`x`') + x = eval('`1 or 2 or 3`') + self.assertEqual(eval('`1,2`'), '(1, 2)') x = x x = 'x' @@ -988,7 +995,13 @@ def test_main(): - run_unittest(TokenTests, GrammarTests) + with silence_py3k_warnings( + ("backquote not supported", SyntaxWarning), + ("tuple parameter unpacking has been removed", SyntaxWarning), + ("parenthesized argument names are invalid", SyntaxWarning), + ("classic int division", DeprecationWarning), + (".+ not supported in 3.x", DeprecationWarning)): + run_unittest(TokenTests, GrammarTests) if __name__ == '__main__': test_main() Index: Lib/test/test_inspect.py =================================================================== --- Lib/test/test_inspect.py (revision 77822) +++ Lib/test/test_inspect.py (working copy) @@ -4,10 +4,12 @@ import inspect import datetime -from test.test_support import TESTFN, run_unittest +from test.test_support import TESTFN, run_unittest, silence_py3k_warnings -from test import inspect_fodder as mod -from test import inspect_fodder2 as mod2 +with silence_py3k_warnings( + ("tuple parameter unpacking has been removed", SyntaxWarning)): + from test import inspect_fodder as mod + from test import inspect_fodder2 as mod2 # C module for test_findsource_binary import unicodedata @@ -29,7 +31,7 @@ import __builtin__ try: - 1/0 + 1 // 0 except: tb = sys.exc_traceback @@ -167,7 +169,7 @@ self.assertEqual(git.tr[1][1:], (modfile, 9, 'spam', [' eggs(b + d, c + f)\n'], 0)) self.assertEqual(git.tr[2][1:], (modfile, 18, 'eggs', - [' q = y / 0\n'], 0)) + [' q = y // 0\n'], 0)) def test_frame(self): args, varargs, varkw, locals = inspect.getargvalues(mod.fr) @@ -418,11 +420,14 @@ self.assertArgSpecEquals(A.m, ['self']) def test_getargspec_sublistofone(self): - def sublistOfOne((foo,)): return 1 - self.assertArgSpecEquals(sublistOfOne, [['foo']]) + with silence_py3k_warnings( + ("tuple parameter unpacking has been removed", SyntaxWarning), + ("parenthesized argument names are invalid", SyntaxWarning)): + exec 'def sublistOfOne((foo,)): return 1' + self.assertArgSpecEquals(sublistOfOne, [['foo']]) - def fakeSublistOfOne((foo)): return 1 - self.assertArgSpecEquals(fakeSublistOfOne, ['foo']) + exec 'def fakeSublistOfOne((foo)): return 1' + self.assertArgSpecEquals(fakeSublistOfOne, ['foo']) def test_classify_oldstyle(self): class A: Index: Lib/test/test_marshal.py =================================================================== --- Lib/test/test_marshal.py (revision 77822) +++ Lib/test/test_marshal.py (working copy) @@ -129,7 +129,9 @@ def test_buffer(self): for s in ["", "Andrč Previn", "abc", " "*10000]: - b = buffer(s) + with test_support.silence_py3k_warnings(("buffer.. not supported", + DeprecationWarning)): + b = buffer(s) new = marshal.loads(marshal.dumps(b)) self.assertEqual(s, new) marshal.dump(b, file(test_support.TESTFN, "wb")) Index: Lib/test/test_multiprocessing.py =================================================================== --- Lib/test/test_multiprocessing.py (revision 77822) +++ Lib/test/test_multiprocessing.py (working copy) @@ -2015,7 +2015,9 @@ loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) - run(suite) + with test_support.silence_py3k_warnings((".+slice__ has been removed", + DeprecationWarning)): + run(suite) ThreadsMixin.pool.terminate() ProcessesMixin.pool.terminate() Index: Lib/test/test_opcodes.py =================================================================== --- Lib/test/test_opcodes.py (revision 77822) +++ Lib/test/test_opcodes.py (working copy) @@ -1,6 +1,6 @@ # Python test set -- part 2, opcodes -from test.test_support import run_unittest +from test.test_support import run_unittest, silence_py3k_warnings import unittest class OpcodeTest(unittest.TestCase): @@ -9,7 +9,7 @@ n = 0 for i in range(10): n = n+i - try: 1/0 + try: 1 // 0 except NameError: pass except ZeroDivisionError: pass except TypeError: pass @@ -110,7 +110,12 @@ def test_main(): - run_unittest(OpcodeTest) + with silence_py3k_warnings(("exceptions must derive from BaseException", + DeprecationWarning), + ("catching classes that don't inherit from " + "BaseException is not allowed", + DeprecationWarning)): + run_unittest(OpcodeTest) if __name__ == '__main__': test_main() Index: Lib/test/test_peepholer.py =================================================================== --- Lib/test/test_peepholer.py (revision 77822) +++ Lib/test/test_peepholer.py (working copy) @@ -206,17 +206,20 @@ import sys from test import test_support test_classes = (TestTranforms,) - test_support.run_unittest(*test_classes) - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts + with test_support.silence_py3k_warnings( + ("backquote not supported", SyntaxWarning)): + test_support.run_unittest(*test_classes) + + # verify reference counting + if verbose and hasattr(sys, "gettotalrefcount"): + import gc + counts = [None] * 5 + for i in xrange(len(counts)): + test_support.run_unittest(*test_classes) + gc.collect() + counts[i] = sys.gettotalrefcount() + print counts if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_richcmp.py =================================================================== --- Lib/test/test_richcmp.py (revision 77822) +++ Lib/test/test_richcmp.py (working copy) @@ -330,7 +330,12 @@ self.assertIs(op(x, y), True) def test_main(): - test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest) + test_support.run_unittest(VectorTest, NumberTest, MiscTest, ListTest) + with test_support.silence_py3k_warnings(("dict inequality comparisons " + "not supported in 3.x", + DeprecationWarning)): + test_support.run_unittest(DictTest) + if __name__ == "__main__": test_main() Index: Lib/test/test_scope.py =================================================================== --- Lib/test/test_scope.py (revision 77822) +++ Lib/test/test_scope.py (working copy) @@ -1,5 +1,6 @@ import unittest -from test.test_support import check_syntax_error, run_unittest +from test.test_support import check_syntax_error, run_unittest, \ + silence_py3k_warnings import warnings warnings.filterwarnings("ignore", r"import \*", SyntaxWarning, "") @@ -321,10 +322,14 @@ self.assertEqual(makeReturner2(a=11)()['a'], 11) - def makeAddPair((a, b)): - def addPair((c, d)): - return (a + c, b + d) - return addPair + with silence_py3k_warnings(("tuple parameter unpacking " + "has been removed", SyntaxWarning)): + exec """\ +def makeAddPair((a, b)): + def addPair((c, d)): + return (a + c, b + d) + return addPair +""" in locals() self.assertEqual(makeAddPair((1, 2))((100, 200)), (101,202)) @@ -471,7 +476,7 @@ return g d = f(2)(4) - self.assertTrue(d.has_key('h')) + self.assertTrue('h' in d) del d['h'] self.assertEqual(d, {'x': 2, 'y': 7, 'w': 6}) Index: Lib/test/test_sort.py =================================================================== --- Lib/test/test_sort.py (revision 77822) +++ Lib/test/test_sort.py (working copy) @@ -185,7 +185,7 @@ def test_stability(self): data = [(random.randrange(100), i) for i in xrange(200)] copy = data[:] - data.sort(key=lambda (x,y): x) # sort on the random first field + data.sort(key=lambda x: x[0]) # sort on the random first field copy.sort() # sort using both fields self.assertEqual(data, copy) # should get the same result @@ -207,7 +207,7 @@ # Verify that the wrapper has been removed data = range(-2,2) dup = data[:] - self.assertRaises(ZeroDivisionError, data.sort, None, lambda x: 1/x) + self.assertRaises(ZeroDivisionError, data.sort, None, lambda x: 1 // x) self.assertEqual(data, dup) def test_key_with_mutation(self): @@ -274,17 +274,19 @@ TestBugs, ) - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts + with test_support.silence_py3k_warnings( + ("the cmp argument is not supported", DeprecationWarning)): + test_support.run_unittest(*test_classes) + + # verify reference counting + if verbose and hasattr(sys, "gettotalrefcount"): + import gc + counts = [None] * 5 + for i in xrange(len(counts)): + test_support.run_unittest(*test_classes) + gc.collect() + counts[i] = sys.gettotalrefcount() + print counts if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_StringIO.py =================================================================== --- Lib/test/test_StringIO.py (revision 77822) +++ Lib/test/test_StringIO.py (working copy) @@ -137,12 +137,10 @@ def test_main(): - test_support.run_unittest( - TestStringIO, - TestcStringIO, - TestBufferStringIO, - TestBuffercStringIO - ) + test_support.run_unittest(TestStringIO, TestcStringIO) + with test_support.silence_py3k_warnings(("buffer.. not supported", + DeprecationWarning)): + test_support.run_unittest(TestBufferStringIO, TestBuffercStringIO) if __name__ == '__main__': test_main() Index: Lib/test/test_struct.py =================================================================== --- Lib/test/test_struct.py (revision 77822) +++ Lib/test/test_struct.py (working copy) @@ -6,7 +6,8 @@ DeprecationWarning) from functools import wraps -from test.test_support import TestFailed, verbose, run_unittest +from test.test_support import TestFailed, verbose, run_unittest, \ + silence_py3k_warnings import sys ISBIGENDIAN = sys.byteorder == "big" @@ -471,7 +472,7 @@ def test_bool(self): for prefix in tuple("<>!=")+('',): false = (), [], [], '', 0 - true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff/2 + true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff//2 falseFormat = prefix + '?' * len(false) packedFalse = struct.pack(falseFormat, *false) @@ -507,7 +508,9 @@ def test_main(): - run_unittest(StructTest) + with silence_py3k_warnings(("buffer.. not supported", + DeprecationWarning)): + run_unittest(StructTest) if __name__ == '__main__': test_main() Index: Lib/test/test_types.py =================================================================== --- Lib/test/test_types.py (revision 77822) +++ Lib/test/test_types.py (working copy) @@ -1,6 +1,7 @@ # Python test set -- part 6, built-in types -from test.test_support import run_unittest, have_unicode, run_with_locale +from test.test_support import run_unittest, have_unicode, run_with_locale, \ + silence_py3k_warnings import unittest import sys import locale @@ -710,7 +711,10 @@ self.assertRaises(ValueError, format, 0, ',' + code) def test_main(): - run_unittest(TypesTests) + with silence_py3k_warnings( + ("buffer.. not supported", DeprecationWarning), + ("classic long division", DeprecationWarning)): + run_unittest(TypesTests) if __name__ == '__main__': test_main() Index: Lib/test/test_userlist.py =================================================================== --- Lib/test/test_userlist.py (revision 77822) +++ Lib/test/test_userlist.py (working copy) @@ -53,7 +53,9 @@ self.assertEqual(iter(T((1,2))).next(), "0!!!") def test_main(): - test_support.run_unittest(UserListTest) + with test_support.silence_py3k_warnings((".+slice__ has been removed", + DeprecationWarning)): + test_support.run_unittest(UserListTest) if __name__ == "__main__": test_main() Index: Lib/test/test_zipimport_support.py =================================================================== --- Lib/test/test_zipimport_support.py (revision 77822) +++ Lib/test/test_zipimport_support.py (working copy) @@ -168,8 +168,13 @@ test_zipped_doctest.test_testfile, test_zipped_doctest.test_unittest_reportflags, ] - for obj in known_good_tests: - _run_object_doctest(obj, test_zipped_doctest) + # Silence Py3k warning + # Needed for test_DocTestParser and test_debug + with test.test_support.silence_py3k_warnings( + ("backquote not supported", SyntaxWarning), + ("execfile.. not supported", DeprecationWarning)): + for obj in known_good_tests: + _run_object_doctest(obj, test_zipped_doctest) def test_doctest_main_issue4197(self): test_src = textwrap.dedent("""\