diff options
| author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-21 01:14:24 (GMT) |
|---|---|---|
| committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-21 01:14:24 (GMT) |
| commit | 07627880813ffaad8d9b90bfe8791ccf588b031b (patch) | |
| tree | 14fbe48b451085257da7c79781999cc86729c74f /Lib/test/test_builtin.py | |
| parent | 8cb253f8d6333af0a575d5951379c090752c0fc6 (diff) | |
| download | cpython-07627880813ffaad8d9b90bfe8791ccf588b031b.zip cpython-07627880813ffaad8d9b90bfe8791ccf588b031b.tar.gz cpython-07627880813ffaad8d9b90bfe8791ccf588b031b.tar.bz2 | |
#7092 - Silence more py3k deprecation warnings, using test_support.check_py3k_warnings() helper.
Diffstat (limited to 'Lib/test/test_builtin.py')
| -rw-r--r-- | Lib/test/test_builtin.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index ac9d85d..05686b9 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -3,14 +3,10 @@ import platform import unittest from test.test_support import fcmp, have_unicode, TESTFN, unlink, \ - run_unittest + run_unittest, check_py3k_warnings from operator import neg -import sys, warnings, cStringIO, random, UserDict -warnings.filterwarnings("ignore", "hex../oct.. of negative int", - FutureWarning, __name__) -warnings.filterwarnings("ignore", "integer argument expected", - DeprecationWarning, "unittest") +import sys, cStringIO, random, UserDict # count the number of test runs. # used to skip running test_execfile() multiple times @@ -419,7 +415,9 @@ class BuiltinTest(unittest.TestCase): f.write('z = z+1\n') f.write('z = z*2\n') f.close() - execfile(TESTFN) + with check_py3k_warnings(("execfile.. not supported in 3.x", + DeprecationWarning)): + execfile(TESTFN) def test_execfile(self): global numruns @@ -1542,17 +1540,24 @@ class TestSorted(unittest.TestCase): 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 check_py3k_warnings( + (".+ not supported in 3.x", DeprecationWarning), + (".+ is renamed to imp.reload", 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 |
