[Python-checkins] cpython (merge default -> default): merge heads

matthias.klose python-checkins at python.org
Mon Apr 13 22:11:55 CEST 2015


https://hg.python.org/cpython/rev/a4b66e51e0bf
changeset:   95611:a4b66e51e0bf
parent:      95610:8d22c77ca9f6
parent:      95608:3aec776fc796
user:        doko at ubuntu.com
date:        Mon Apr 13 22:11:34 2015 +0200
summary:
  merge heads

files:
  Lib/test/datetimetester.py              |   5 +-
  Lib/test/test___future__.py             |   6 +--
  Lib/test/test__opcode.py                |   7 +--
  Lib/test/test__osx_support.py           |   6 +--
  Lib/test/test_atexit.py                 |   6 +--
  Lib/test/test_augassign.py              |   6 +--
  Lib/test/test_binascii.py               |   9 +---
  Lib/test/test_binop.py                  |   5 +-
  Lib/test/test_call.py                   |   7 +--
  Lib/test/test_cgitb.py                  |   6 +--
  Lib/test/test_charmapcodec.py           |   5 +-
  Lib/test/test_class.py                  |   8 +--
  Lib/test/test_cmath.py                  |   7 +--
  Lib/test/test_code_module.py            |   3 -
  Lib/test/test_codecencodings_cn.py      |   5 +-
  Lib/test/test_codecencodings_hk.py      |   5 +-
  Lib/test/test_codecencodings_iso2022.py |   5 +-
  Lib/test/test_codecencodings_jp.py      |   5 +-
  Lib/test/test_codecencodings_kr.py      |   5 +-
  Lib/test/test_codecencodings_tw.py      |   5 +-
  Lib/test/test_codeop.py                 |   8 +--
  Lib/test/test_compare.py                |   6 +--
  Lib/test/test_contains.py               |   6 +--
  Lib/test/test_copy.py                   |   6 +--
  Lib/test/test_copyreg.py                |   7 +--
  Lib/test/test_crashers.py               |   5 +-
  Lib/test/test_csv.py                    |   8 +---
  Lib/test/test_decorators.py             |   9 +---
  Lib/test/test_defaultdict.py            |   6 +--
  Lib/test/test_dict.py                   |   9 +---
  Lib/test/test_dictviews.py              |   6 +--
  Lib/test/test_dis.py                    |   2 +-
  Lib/test/test_docxmlrpc.py              |   5 +-
  Lib/test/test_dummy_threading.py        |   6 +--
  Lib/test/test_dynamic.py                |   8 +--
  Lib/test/test_dynamicclassattribute.py  |   6 +--
  Lib/test/test_ensurepip.py              |   2 +-
  Lib/test/test_enumerate.py              |  13 +-----
  Lib/test/test_eof.py                    |   5 +-
  Lib/test/test_epoll.py                  |   5 +-
  Lib/test/test_errno.py                  |   7 +--
  Lib/test/test_exception_variations.py   |   6 +--
  Lib/test/test_file_eintr.py             |  10 +----
  Lib/test/test_finalization.py           |   5 +-
  Lib/test/test_float.py                  |  15 +------
  Lib/test/test_flufl.py                  |   7 +--
  Lib/test/test_fnmatch.py                |   9 +---
  Lib/test/test_fork1.py                  |   7 +-
  Lib/test/test_fractions.py              |   7 +--
  Lib/test/test_frame.py                  |   5 +-
  Lib/test/test_funcattrs.py              |  10 +----
  Lib/test/test_functools.py              |  29 +------------
  Lib/test/test_getopt.py                 |   7 +--
  Lib/test/test_grammar.py                |   7 +--
  Lib/test/test_grp.py                    |   5 +-
  Lib/test/test_hmac.py                   |  11 +----
  Lib/test/test_html.py                   |   1 -
  Lib/test/test_int.py                    |   5 +-
  Lib/test/test_int_literal.py            |   6 +--
  Lib/test/test_ioctl.py                  |   2 +-
  Lib/test/test_isinstance.py             |  11 +----
  Lib/test/test_keywordonlyarg.py         |   6 +--
  Lib/test/test_kqueue.py                 |   6 +--
  Lib/test/test_list.py                   |  17 +-------
  Lib/test/test_long.py                   |   5 +-
  Lib/test/test_longexp.py                |   8 +--
  Lib/test/test_mailcap.py                |   6 +--
  Lib/test/test_memoryio.py               |   7 +--
  Lib/test/test_memoryview.py             |   5 +-
  Lib/test/test_mimetypes.py              |   8 +---
  Lib/test/test_minidom.py                |   7 +--
  Lib/test/test_module.py                 |   8 +--
  Lib/test/test_msilib.py                 |   7 +--
  Lib/test/test_nis.py                    |   5 +-
  Lib/test/test_normalization.py          |   7 +--
  Lib/test/test_numeric_tower.py          |   6 +--
  Lib/test/test_opcodes.py                |   6 +--
  Lib/test/test_openpty.py                |   6 +--
  Lib/test/test_osx_env.py                |   2 +-
  Lib/test/test_parser.py                 |  13 +-----
  Lib/test/test_peepholer.py              |  18 +-------
  Lib/test/test_pep247.py                 |   6 +--
  Lib/test/test_pep292.py                 |   8 +---
  Lib/test/test_pep3120.py                |   8 +--
  Lib/test/test_pep3131.py                |   8 +--
  Lib/test/test_pep3151.py                |   8 +--
  Lib/test/test_pep380.py                 |   8 +---
  Lib/test/test_pkg.py                    |   6 +--
  Lib/test/test_pkgimport.py              |   8 +--
  Lib/test/test_popen.py                  |   5 +-
  Lib/test/test_pow.py                    |   5 +-
  Lib/test/test_property.py               |   6 +--
  Lib/test/test_pstats.py                 |   9 +---
  Lib/test/test_pty.py                    |  11 +---
  Lib/test/test_pulldom.py                |   8 +--
  Lib/test/test_pwd.py                    |   5 +-
  Lib/test/test_pyclbr.py                 |   7 +--
  Lib/test/test_pyexpat.py                |  18 +-------
  Lib/test/test_queue.py                  |   7 +--
  Lib/test/test_quopri.py                 |   7 +--
  Lib/test/test_raise.py                  |   3 -
  Lib/test/test_range.py                  |   5 +-
  Lib/test/test_readline.py               |   7 +--
  Lib/test/test_richcmp.py                |   5 +-
  Lib/test/test_rlcompleter.py            |   7 +--
  Lib/test/test_runpy.py                  |   2 +-
  Lib/test/test_scope.py                  |   7 +--
  Lib/test/test_select.py                 |   5 +-
  Lib/test/test_shlex.py                  |   6 +--
  Lib/test/test_signal.py                 |  14 +----
  Lib/test/test_slice.py                  |   6 +--
  Lib/test/test_smtpnet.py                |   5 +-
  Lib/test/test_sort.py                   |  21 +--------
  Lib/test/test_startfile.py              |   7 +--
  Lib/test/test_string.py                 |   6 +--
  Lib/test/test_stringprep.py             |   6 +--
  Lib/test/test_strlit.py                 |   6 +--
  Lib/test/test_strptime.py               |  15 +------
  Lib/test/test_strtod.py                 |   5 +-
  Lib/test/test_struct.py                 |   5 +-
  Lib/test/test_structmembers.py          |   5 +-
  Lib/test/test_structseq.py              |   6 +--
  Lib/test/test_super.py                  |   5 --
  Lib/test/test_symtable.py               |   6 +--
  Lib/test/test_sys_setprofile.py         |  11 +----
  Lib/test/test_syslog.py                 |   5 +-
  Lib/test/test_telnetlib.py              |   6 +--
  Lib/test/test_tempfile.py               |   5 +-
  Lib/test/test_thread.py                 |   6 +--
  Lib/test/test_timeit.py                 |   6 +--
  Lib/test/test_tuple.py                  |   7 +--
  Lib/test/test_typechecks.py             |   5 --
  Lib/test/test_types.py                  |   8 +--
  Lib/test/test_ucn.py                    |   5 +-
  Lib/test/test_unary.py                  |   7 +--
  Lib/test/test_unicodedata.py            |   9 +---
  Lib/test/test_userdict.py               |   7 +--
  Lib/test/test_userlist.py               |   5 +-
  Lib/test/test_venv.py                   |   7 +--
  Lib/test/test_wait3.py                  |   7 +-
  Lib/test/test_wait4.py                  |   7 +-
  Lib/test/test_weakset.py                |   6 +--
  Lib/test/test_winsound.py               |   7 +--
  Lib/test/test_with.py                   |  12 +----
  Lib/test/test_wsgiref.py                |   5 +-
  Lib/test/test_xdrlib.py                 |   7 +--
  Lib/test/test_zipimport_support.py      |   5 +-
  Lib/test/test_zlib.py                   |  13 +-----
  148 files changed, 184 insertions(+), 866 deletions(-)


diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -3885,8 +3885,5 @@
         with self.assertRaises(TypeError):
             datetime(10, 10, 10, 10, 10, 10, 10.)
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test___future__.py b/Lib/test/test___future__.py
--- a/Lib/test/test___future__.py
+++ b/Lib/test/test___future__.py
@@ -1,5 +1,4 @@
 import unittest
-from test import support
 import __future__
 
 GOOD_SERIALS = ("alpha", "beta", "candidate", "final")
@@ -58,8 +57,5 @@
                    ".compiler_flag isn't int")
 
 
-def test_main():
-    support.run_unittest(FutureTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test__opcode.py b/Lib/test/test__opcode.py
--- a/Lib/test/test__opcode.py
+++ b/Lib/test/test__opcode.py
@@ -1,5 +1,5 @@
 import dis
-from test.support import run_unittest, import_module
+from test.support import import_module
 import unittest
 
 _opcode = import_module("_opcode")
@@ -16,8 +16,5 @@
         self.assertRaises(ValueError, _opcode.stack_effect, dis.opmap['BUILD_SLICE'])
         self.assertRaises(ValueError, _opcode.stack_effect, dis.opmap['POP_TOP'], 0)
 
-def test_main():
-    run_unittest(OpcodeTests)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test__osx_support.py b/Lib/test/test__osx_support.py
--- a/Lib/test/test__osx_support.py
+++ b/Lib/test/test__osx_support.py
@@ -273,9 +273,5 @@
         result = _osx_support.get_platform_osx(config_vars, ' ', ' ', ' ')
         self.assertEqual(('macosx', '10.6', 'fat'), result)
 
-def test_main():
-    if sys.platform == 'darwin':
-        test.support.run_unittest(Test_OSXSupport)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py
--- a/Lib/test/test_atexit.py
+++ b/Lib/test/test_atexit.py
@@ -177,9 +177,5 @@
         self.assertEqual(atexit._ncallbacks(), n)
 
 
-def test_main():
-    support.run_unittest(__name__)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_augassign.py b/Lib/test/test_augassign.py
--- a/Lib/test/test_augassign.py
+++ b/Lib/test/test_augassign.py
@@ -1,6 +1,5 @@
 # Augmented assignment test.
 
-from test.support import run_unittest
 import unittest
 
 
@@ -315,8 +314,5 @@
 __ilshift__ called
 '''.splitlines())
 
-def test_main():
-    run_unittest(AugAssignTest)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py
--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@ -1,6 +1,5 @@
 """Test the binascii C module."""
 
-from test import support
 import unittest
 import binascii
 import array
@@ -262,11 +261,5 @@
     type2test = memoryview
 
 
-def test_main():
-    support.run_unittest(BinASCIITest,
-                         ArrayBinASCIITest,
-                         BytearrayBinASCIITest,
-                         MemoryviewBinASCIITest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_binop.py b/Lib/test/test_binop.py
--- a/Lib/test/test_binop.py
+++ b/Lib/test/test_binop.py
@@ -369,8 +369,5 @@
         self.assertEqual(op_sequence(le, B, C), ['C.__ge__', 'B.__le__'])
         self.assertEqual(op_sequence(le, C, B), ['C.__le__', 'B.__ge__'])
 
-def test_main():
-    support.run_unittest(RatTestCase, OperationOrderTests)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py
--- a/Lib/test/test_call.py
+++ b/Lib/test/test_call.py
@@ -1,5 +1,4 @@
 import unittest
-from test import support
 
 # The test cases here cover several paths through the function calling
 # code.  They depend on the METH_XXX flag that is used to define a C
@@ -123,9 +122,5 @@
         self.assertRaises(TypeError, [].count, x=2, y=2)
 
 
-def test_main():
-    support.run_unittest(CFunctionCalls)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_cgitb.py b/Lib/test/test_cgitb.py
--- a/Lib/test/test_cgitb.py
+++ b/Lib/test/test_cgitb.py
@@ -1,4 +1,3 @@
-from test.support import run_unittest
 from test.script_helper import assert_python_failure, temp_dir
 import unittest
 import sys
@@ -63,8 +62,5 @@
         self.assertNotIn('</p>', out)
 
 
-def test_main():
-    run_unittest(TestCgitb)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_charmapcodec.py b/Lib/test/test_charmapcodec.py
--- a/Lib/test/test_charmapcodec.py
+++ b/Lib/test/test_charmapcodec.py
@@ -49,8 +49,5 @@
     def test_maptoundefined(self):
         self.assertRaises(UnicodeError, str, b'abc\001', codecname)
 
-def test_main():
-    test.support.run_unittest(CharmapCodecTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -2,7 +2,6 @@
 
 import unittest
 
-from test import support
 
 testmeths = [
 
@@ -569,8 +568,5 @@
         a = A(hash(A.f)^(-1))
         hash(a.f)
 
-def test_main():
-    support.run_unittest(ClassTests)
-
-if __name__=='__main__':
-    test_main()
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_cmath.py b/Lib/test/test_cmath.py
--- a/Lib/test/test_cmath.py
+++ b/Lib/test/test_cmath.py
@@ -1,4 +1,4 @@
-from test.support import run_unittest, requires_IEEE_754
+from test.support import requires_IEEE_754
 from test.test_math import parse_testfile, test_file
 import unittest
 import cmath, math
@@ -529,8 +529,5 @@
             self.assertComplexIdentical(cmath.atanh(z), z)
 
 
-def test_main():
-    run_unittest(CMathTests)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_code_module.py b/Lib/test/test_code_module.py
--- a/Lib/test/test_code_module.py
+++ b/Lib/test/test_code_module.py
@@ -114,8 +114,5 @@
         self.assertIn(expected, output)
 
 
-def test_main():
-    support.run_unittest(TestInteractiveConsole)
-
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py
--- a/Lib/test/test_codecencodings_cn.py
+++ b/Lib/test/test_codecencodings_cn.py
@@ -83,8 +83,5 @@
         (b"ab~{\x79\x79\x41\x44~}cd", "replace", "ab\ufffd\ufffd\u804acd"),
     )
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_codecencodings_hk.py b/Lib/test/test_codecencodings_hk.py
--- a/Lib/test/test_codecencodings_hk.py
+++ b/Lib/test/test_codecencodings_hk.py
@@ -19,8 +19,5 @@
         (b"abc\x80\x80\xc1\xc4", "ignore",  "abc\u8b10"),
     )
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_codecencodings_iso2022.py b/Lib/test/test_codecencodings_iso2022.py
--- a/Lib/test/test_codecencodings_iso2022.py
+++ b/Lib/test/test_codecencodings_iso2022.py
@@ -38,8 +38,5 @@
     def test_chunkcoding(self):
         pass
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_codecencodings_jp.py b/Lib/test/test_codecencodings_jp.py
--- a/Lib/test/test_codecencodings_jp.py
+++ b/Lib/test/test_codecencodings_jp.py
@@ -123,8 +123,5 @@
         b"\x85Gℜ\x85Q = ⟨ሴ⟩"
     )
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_codecencodings_kr.py b/Lib/test/test_codecencodings_kr.py
--- a/Lib/test/test_codecencodings_kr.py
+++ b/Lib/test/test_codecencodings_kr.py
@@ -66,8 +66,5 @@
         (b"\x8CBxy", "replace",  "\uFFFDBxy"),
     )
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_codecencodings_tw.py b/Lib/test/test_codecencodings_tw.py
--- a/Lib/test/test_codecencodings_tw.py
+++ b/Lib/test/test_codecencodings_tw.py
@@ -19,8 +19,5 @@
         (b"abc\x80\x80\xc1\xc4", "ignore",  "abc\u8b10"),
     )
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py
--- a/Lib/test/test_codeop.py
+++ b/Lib/test/test_codeop.py
@@ -3,7 +3,7 @@
    Nick Mathewson
 """
 import unittest
-from test.support import run_unittest, is_jython
+from test.support import is_jython
 
 from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT
 import io
@@ -296,9 +296,5 @@
                             compile("a = 1\n", "def", 'single').co_filename)
 
 
-def test_main():
-    run_unittest(CodeopTests)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -1,5 +1,4 @@
 import unittest
-from test import support
 
 class Empty:
     def __repr__(self):
@@ -121,8 +120,5 @@
         self.assertEqual(Anything(), y)
 
 
-def test_main():
-    support.run_unittest(ComparisonTest)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py
--- a/Lib/test/test_contains.py
+++ b/Lib/test/test_contains.py
@@ -1,5 +1,4 @@
 from collections import deque
-from test.support import run_unittest
 import unittest
 
 
@@ -86,8 +85,5 @@
             self.assertTrue(container == container)
 
 
-def test_main():
-    run_unittest(TestContains)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -7,7 +7,6 @@
 from operator import le, lt, ge, gt, eq, ne
 
 import unittest
-from test import support
 
 order_comparisons = le, lt, ge, gt
 equality_comparisons = eq, ne
@@ -822,8 +821,5 @@
 
 def global_foo(x, y): return x+y
 
-def test_main():
-    support.run_unittest(TestCopy)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_copyreg.py b/Lib/test/test_copyreg.py
--- a/Lib/test/test_copyreg.py
+++ b/Lib/test/test_copyreg.py
@@ -1,7 +1,6 @@
 import copyreg
 import unittest
 
-from test import support
 from test.pickletester import ExtensionSaver
 
 class C:
@@ -113,9 +112,5 @@
         self.assertEqual(result, expected)
 
 
-def test_main():
-    support.run_unittest(CopyRegTestCase)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_crashers.py b/Lib/test/test_crashers.py
--- a/Lib/test/test_crashers.py
+++ b/Lib/test/test_crashers.py
@@ -30,9 +30,8 @@
             assert_python_failure(fname)
 
 
-def test_main():
-    test.support.run_unittest(CrasherTest)
+def tearDownModule():
     test.support.reap_children()
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py
--- a/Lib/test/test_csv.py
+++ b/Lib/test/test_csv.py
@@ -1084,11 +1084,5 @@
             self.assertEqual(fileobj.read(), expected)
 
 
-def test_main():
-    mod = sys.modules[__name__]
-    support.run_unittest(
-        *[getattr(mod, name) for name in dir(mod) if name.startswith('Test')]
-    )
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_decorators.py b/Lib/test/test_decorators.py
--- a/Lib/test/test_decorators.py
+++ b/Lib/test/test_decorators.py
@@ -1,5 +1,4 @@
 import unittest
-from test import support
 
 def funcattrs(**kwds):
     def decorate(func):
@@ -301,9 +300,5 @@
         class C(object): pass
         self.assertEqual(C.extra, 'second')
 
-def test_main():
-    support.run_unittest(TestDecorators)
-    support.run_unittest(TestClassDecorators)
-
-if __name__=="__main__":
-    test_main()
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py
--- a/Lib/test/test_defaultdict.py
+++ b/Lib/test/test_defaultdict.py
@@ -5,7 +5,6 @@
 import pickle
 import tempfile
 import unittest
-from test import support
 
 from collections import defaultdict
 
@@ -184,8 +183,5 @@
             o = pickle.loads(s)
             self.assertEqual(d, o)
 
-def test_main():
-    support.run_unittest(TestDefaultDict)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -949,12 +949,5 @@
 class SubclassMappingTests(mapping_tests.BasicTestMappingProtocol):
     type2test = Dict
 
-def test_main():
-    support.run_unittest(
-        DictTest,
-        GeneralMappingTests,
-        SubclassMappingTests,
-    )
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py
--- a/Lib/test/test_dictviews.py
+++ b/Lib/test/test_dictviews.py
@@ -1,5 +1,4 @@
 import unittest
-from test import support
 
 class DictSetTest(unittest.TestCase):
 
@@ -199,8 +198,5 @@
         self.assertRaises(RuntimeError, repr, d)
 
 
-def test_main():
-    support.run_unittest(DictSetTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -1,6 +1,6 @@
 # Minimal tests for dis module
 
-from test.support import run_unittest, captured_stdout
+from test.support import captured_stdout
 from test.bytecode_helper import BytecodeTestCase
 import difflib
 import unittest
diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py
--- a/Lib/test/test_docxmlrpc.py
+++ b/Lib/test/test_docxmlrpc.py
@@ -213,8 +213,5 @@
             response.read())
 
 
-def test_main():
-    support.run_unittest(DocXMLRPCHTTPGETServer)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py
--- a/Lib/test/test_dummy_threading.py
+++ b/Lib/test/test_dummy_threading.py
@@ -56,9 +56,5 @@
         if support.verbose:
             print('all tasks done')
 
-def test_main():
-    support.run_unittest(DummyThreadingTestCase)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dynamic.py b/Lib/test/test_dynamic.py
--- a/Lib/test/test_dynamic.py
+++ b/Lib/test/test_dynamic.py
@@ -4,7 +4,7 @@
 import contextlib
 import unittest
 
-from test.support import run_unittest, swap_item, swap_attr
+from test.support import swap_item, swap_attr
 
 
 class RebindBuiltinsTests(unittest.TestCase):
@@ -135,9 +135,5 @@
         self.assertEqual(foo(), 7)
 
 
-def test_main():
-    run_unittest(RebindBuiltinsTests)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dynamicclassattribute.py b/Lib/test/test_dynamicclassattribute.py
--- a/Lib/test/test_dynamicclassattribute.py
+++ b/Lib/test/test_dynamicclassattribute.py
@@ -4,7 +4,6 @@
 import abc
 import sys
 import unittest
-from test.support import run_unittest
 from types import DynamicClassAttribute
 
 class PropertyBase(Exception):
@@ -297,8 +296,5 @@
 
 
 
-def test_main():
-    run_unittest(PropertyTests, PropertySubclassTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_ensurepip.py b/Lib/test/test_ensurepip.py
--- a/Lib/test/test_ensurepip.py
+++ b/Lib/test/test_ensurepip.py
@@ -342,4 +342,4 @@
 
 
 if __name__ == "__main__":
-    test.support.run_unittest(__name__)
+    unittest.main()
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py
--- a/Lib/test/test_enumerate.py
+++ b/Lib/test/test_enumerate.py
@@ -258,16 +258,5 @@
                        (sys.maxsize+3,'c')]
 
 
-def test_main(verbose=None):
-    support.run_unittest(__name__)
-
-    # verify reference counting
-    if verbose and hasattr(sys, "gettotalrefcount"):
-        counts = [None] * 5
-        for i in range(len(counts)):
-            support.run_unittest(__name__)
-            counts[i] = sys.gettotalrefcount()
-        print(counts)
-
 if __name__ == "__main__":
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py
--- a/Lib/test/test_eof.py
+++ b/Lib/test/test_eof.py
@@ -24,8 +24,5 @@
         else:
             raise support.TestFailed
 
-def test_main():
-    support.run_unittest(EOFTestCase)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_epoll.py b/Lib/test/test_epoll.py
--- a/Lib/test/test_epoll.py
+++ b/Lib/test/test_epoll.py
@@ -252,8 +252,5 @@
         self.assertEqual(os.get_inheritable(epoll.fileno()), False)
 
 
-def test_main():
-    support.run_unittest(TestEPoll)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_errno.py b/Lib/test/test_errno.py
--- a/Lib/test/test_errno.py
+++ b/Lib/test/test_errno.py
@@ -3,7 +3,6 @@
 """
 
 import errno
-from test import support
 import unittest
 
 std_c_errors = frozenset(['EDOM', 'ERANGE'])
@@ -32,9 +31,5 @@
                               'no %s attr in errno.errorcode' % attribute)
 
 
-def test_main():
-    support.run_unittest(ErrnoAttributeTests, ErrorcodeTests)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_exception_variations.py b/Lib/test/test_exception_variations.py
--- a/Lib/test/test_exception_variations.py
+++ b/Lib/test/test_exception_variations.py
@@ -1,5 +1,4 @@
 
-from test.support import run_unittest
 import unittest
 
 class ExceptionTestCase(unittest.TestCase):
@@ -173,8 +172,5 @@
         self.assertTrue(hit_finally)
         self.assertTrue(hit_except)
 
-def test_main():
-    run_unittest(ExceptionTestCase)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_file_eintr.py b/Lib/test/test_file_eintr.py
--- a/Lib/test/test_file_eintr.py
+++ b/Lib/test/test_file_eintr.py
@@ -13,7 +13,6 @@
 import signal
 import subprocess
 import sys
-from test.support import run_unittest
 import time
 import unittest
 
@@ -249,12 +248,5 @@
     modname = '_pyio'
 
 
-def test_main():
-    test_cases = [
-            tc for tc in globals().values()
-            if isinstance(tc, type) and issubclass(tc, unittest.TestCase)]
-    run_unittest(*test_cases)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_finalization.py b/Lib/test/test_finalization.py
--- a/Lib/test/test_finalization.py
+++ b/Lib/test/test_finalization.py
@@ -515,8 +515,5 @@
         self.assertIs(wr(), None)
 
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -1299,18 +1299,5 @@
                 self.identical(x, fromHex(toHex(x)))
 
 
-def test_main():
-    support.run_unittest(
-        GeneralFloatCases,
-        FormatFunctionsTestCase,
-        UnknownFormatTestCase,
-        IEEEFormatTestCase,
-        FormatTestCase,
-        ReprTestCase,
-        RoundTestCase,
-        InfNanTest,
-        HexFloatTestCase,
-        )
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_flufl.py b/Lib/test/test_flufl.py
--- a/Lib/test/test_flufl.py
+++ b/Lib/test/test_flufl.py
@@ -18,10 +18,5 @@
                             '<FLUFL test>', 'exec')
 
 
-def test_main():
-    from test.support import run_unittest
-    run_unittest(FLUFLTests)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_fnmatch.py b/Lib/test/test_fnmatch.py
--- a/Lib/test/test_fnmatch.py
+++ b/Lib/test/test_fnmatch.py
@@ -1,6 +1,5 @@
 """Test cases for the fnmatch module."""
 
-from test import support
 import unittest
 
 from fnmatch import fnmatch, fnmatchcase, translate, filter
@@ -79,11 +78,5 @@
         self.assertEqual(filter(['a', 'b'], 'a'), ['a'])
 
 
-def test_main():
-    support.run_unittest(FnmatchTestCase,
-                         TranslateTestCase,
-                         FilterTestCase)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py
--- a/Lib/test/test_fork1.py
+++ b/Lib/test/test_fork1.py
@@ -8,7 +8,7 @@
 import time
 
 from test.fork_wait import ForkWait
-from test.support import (run_unittest, reap_children, get_attribute,
+from test.support import (reap_children, get_attribute,
                           import_module, verbose)
 
 threading = import_module('threading')
@@ -104,9 +104,8 @@
             fork_with_import_lock(level)
 
 
-def test_main():
-    run_unittest(ForkTest)
+def tearDownModule():
     reap_children()
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -1,7 +1,7 @@
 """Tests for Lib/fractions.py."""
 
 from decimal import Decimal
-from test.support import run_unittest, requires_IEEE_754
+from test.support import requires_IEEE_754
 import math
 import numbers
 import operator
@@ -606,8 +606,5 @@
         r = F(13, 7)
         self.assertRaises(AttributeError, setattr, r, 'a', 10)
 
-def test_main():
-    run_unittest(FractionTest, GcdTest)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_frame.py b/Lib/test/test_frame.py
--- a/Lib/test/test_frame.py
+++ b/Lib/test/test_frame.py
@@ -161,8 +161,5 @@
         self.assertEqual(inner.f_locals, {})
 
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -1,4 +1,3 @@
-from test import support
 import types
 import unittest
 
@@ -374,12 +373,5 @@
         self.assertEqual({'foo': 'bar'}.pop.__qualname__, 'dict.pop')
 
 
-def test_main():
-    support.run_unittest(FunctionPropertiesTest, InstancemethodAttrTest,
-                              ArbitraryFunctionAttrTest, FunctionDictsTest,
-                              FunctionDocstringTest, CellTest,
-                              StaticMethodAttrsTest,
-                              BuiltinFunctionPropertiesTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -1584,32 +1584,5 @@
         functools.WeakKeyDictionary = _orig_wkd
 
 
-def test_main(verbose=None):
-    test_classes = (
-        TestPartialC,
-        TestPartialPy,
-        TestPartialCSubclass,
-        TestPartialMethod,
-        TestUpdateWrapper,
-        TestTotalOrdering,
-        TestCmpToKeyC,
-        TestCmpToKeyPy,
-        TestWraps,
-        TestReduce,
-        TestLRU,
-        TestSingleDispatch,
-    )
-    support.run_unittest(*test_classes)
-
-    # verify reference counting
-    if verbose and hasattr(sys, "gettotalrefcount"):
-        import gc
-        counts = [None] * 5
-        for i in range(len(counts)):
-            support.run_unittest(*test_classes)
-            gc.collect()
-            counts[i] = sys.gettotalrefcount()
-        print(counts)
-
 if __name__ == '__main__':
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_getopt.py b/Lib/test/test_getopt.py
--- a/Lib/test/test_getopt.py
+++ b/Lib/test/test_getopt.py
@@ -1,7 +1,7 @@
 # test_getopt.py
 # David Goodger <dgoodger at bigfoot.com> 2000-08-19
 
-from test.support import verbose, run_doctest, run_unittest, EnvironmentVarGuard
+from test.support import verbose, run_doctest, EnvironmentVarGuard
 import unittest
 
 import getopt
@@ -180,8 +180,5 @@
         self.assertEqual(longopts, [('--help', 'x')])
         self.assertRaises(getopt.GetoptError, getopt.getopt, ['--help='], '', ['help'])
 
-def test_main():
-    run_unittest(GetoptTests)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -1,7 +1,7 @@
 # Python test set -- part 1, grammar.
 # This just tests whether the parser accepts them all.
 
-from test.support import run_unittest, check_syntax_error
+from test.support import check_syntax_error
 import unittest
 import sys
 # testing import *
@@ -1031,8 +1031,5 @@
         self.assertEqual(m.other, 42)
 
 
-def test_main():
-    run_unittest(TokenTests, GrammarTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py
--- a/Lib/test/test_grp.py
+++ b/Lib/test/test_grp.py
@@ -92,8 +92,5 @@
 
         self.assertRaises(KeyError, grp.getgrgid, fakegid)
 
-def test_main():
-    support.run_unittest(GroupDatabaseTestCase)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -493,14 +493,5 @@
         self.assertFalse(hmac.compare_digest(a, b))
 
 
-def test_main():
-    support.run_unittest(
-        TestVectorsTestCase,
-        ConstructorTestCase,
-        SanityTestCase,
-        CopyTestCase,
-        CompareDigestTestCase
-    )
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_html.py b/Lib/test/test_html.py
--- a/Lib/test/test_html.py
+++ b/Lib/test/test_html.py
@@ -4,7 +4,6 @@
 
 import html
 import unittest
-from test.support import run_unittest
 
 
 class HtmlTests(unittest.TestCase):
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py
--- a/Lib/test/test_int.py
+++ b/Lib/test/test_int.py
@@ -451,8 +451,5 @@
         check('123\ud800')
         check('123\ud800', 10)
 
-def test_main():
-    support.run_unittest(IntTestCases)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_int_literal.py b/Lib/test/test_int_literal.py
--- a/Lib/test/test_int_literal.py
+++ b/Lib/test/test_int_literal.py
@@ -4,7 +4,6 @@
 """
 
 import unittest
-from test import support
 
 class TestHexOctBin(unittest.TestCase):
 
@@ -140,8 +139,5 @@
         self.assertEqual(-0b1000000000000000000000000000000000000000000000000000000000000000, -9223372036854775808)
         self.assertEqual(-0b1111111111111111111111111111111111111111111111111111111111111111, -18446744073709551615)
 
-def test_main():
-    support.run_unittest(TestHexOctBin)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_ioctl.py b/Lib/test/test_ioctl.py
--- a/Lib/test/test_ioctl.py
+++ b/Lib/test/test_ioctl.py
@@ -1,6 +1,6 @@
 import array
 import unittest
-from test.support import run_unittest, import_module, get_attribute
+from test.support import import_module, get_attribute
 import os, struct
 fcntl = import_module('fcntl')
 termios = import_module('termios')
diff --git a/Lib/test/test_isinstance.py b/Lib/test/test_isinstance.py
--- a/Lib/test/test_isinstance.py
+++ b/Lib/test/test_isinstance.py
@@ -3,7 +3,6 @@
 # testing of error conditions uncovered when using extension types.
 
 import unittest
-from test import support
 import sys
 
 
@@ -277,13 +276,5 @@
         fxn(arg, tuple_arg)
 
 

-def test_main():
-    support.run_unittest(
-        TestIsInstanceExceptions,
-        TestIsSubclassExceptions,
-        TestIsInstanceIsSubclass
-    )
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py
--- a/Lib/test/test_keywordonlyarg.py
+++ b/Lib/test/test_keywordonlyarg.py
@@ -4,7 +4,6 @@
 __email__ = "seojiwon at gmail dot com"
 
 import unittest
-from test.support import run_unittest
 
 def posonly_sum(pos_arg1, *arg, **kwarg):
     return pos_arg1 + sum(arg) + sum(kwarg.values())
@@ -186,8 +185,5 @@
         self.assertEqual(str(err.exception), "name 'b' is not defined")
 
 
-def test_main():
-    run_unittest(KeywordOnlyArgTestCase)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py
--- a/Lib/test/test_kqueue.py
+++ b/Lib/test/test_kqueue.py
@@ -9,7 +9,6 @@
 import time
 import unittest
 
-from test import support
 if not hasattr(select, "kqueue"):
     raise unittest.SkipTest("test works only on BSD")
 
@@ -237,8 +236,5 @@
         self.assertEqual(os.get_inheritable(kqueue.fileno()), False)
 
 
-def test_main():
-    support.run_unittest(TestKQueue)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -108,20 +108,5 @@
         with self.assertRaises(TypeError):
             (3,) + L([1,2])
 
-def test_main(verbose=None):
-    support.run_unittest(ListTest)
-
-    # verify reference counting
-    import sys
-    if verbose and hasattr(sys, "gettotalrefcount"):
-        import gc
-        counts = [None] * 5
-        for i in range(len(counts)):
-            support.run_unittest(ListTest)
-            gc.collect()
-            counts[i] = sys.gettotalrefcount()
-        print(counts)
-
-
 if __name__ == "__main__":
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -1241,8 +1241,5 @@
                 self.assertEqual(type(value >> shift), int)
 
 
-def test_main():
-    support.run_unittest(LongTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_longexp.py b/Lib/test/test_longexp.py
--- a/Lib/test/test_longexp.py
+++ b/Lib/test/test_longexp.py
@@ -1,5 +1,4 @@
 import unittest
-from test import support
 
 class LongExpText(unittest.TestCase):
     def test_longexp(self):
@@ -7,8 +6,5 @@
         l = eval("[" + "2," * REPS + "]")
         self.assertEqual(len(l), REPS)
 
-def test_main():
-    support.run_unittest(LongExpText)
-
-if __name__=="__main__":
-    test_main()
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_mailcap.py b/Lib/test/test_mailcap.py
--- a/Lib/test/test_mailcap.py
+++ b/Lib/test/test_mailcap.py
@@ -213,9 +213,5 @@
             self.assertEqual(mailcap.findmatch(*c[0], **c[1]), c[2])
 
 
-def test_main():
-    test.support.run_unittest(HelperFunctionTest, GetcapsTest, FindmatchTest)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -826,10 +826,5 @@
             pass
 
 
-def test_main():
-    tests = [PyBytesIOTest, PyStringIOTest, CBytesIOTest, CStringIOTest,
-             PyStringIOPickleTest, CStringIOPickleTest]
-    support.run_unittest(*tests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -492,8 +492,5 @@
     pass
 
 
-def test_main():
-    test.support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py
--- a/Lib/test/test_mimetypes.py
+++ b/Lib/test/test_mimetypes.py
@@ -101,11 +101,5 @@
         eq(self.db.guess_type("image.jpg"), ("image/jpeg", None))
         eq(self.db.guess_type("image.png"), ("image/png", None))
 
-def test_main():
-    support.run_unittest(MimeTypesTestCase,
-        Win32MimeTypesTestCase
-        )
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -1,7 +1,7 @@
 # test for xml.dom.minidom
 
 import pickle
-from test.support import run_unittest, findfile
+from test.support import findfile
 import unittest
 
 import xml.dom.minidom
@@ -1545,8 +1545,5 @@
         pi = doc.createProcessingInstruction("y", "z")
         pi.nodeValue = "crash"
 
-def test_main():
-    run_unittest(MinidomTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py
--- a/Lib/test/test_module.py
+++ b/Lib/test/test_module.py
@@ -1,7 +1,7 @@
 # Test the module type
 import unittest
 import weakref
-from test.support import run_unittest, gc_collect
+from test.support import gc_collect
 from test.script_helper import assert_python_ok
 
 import sys
@@ -238,9 +238,5 @@
     # frozen and namespace module reprs are tested in importlib.
 
 
-def test_main():
-    run_unittest(ModuleTests)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_msilib.py b/Lib/test/test_msilib.py
--- a/Lib/test/test_msilib.py
+++ b/Lib/test/test_msilib.py
@@ -1,7 +1,7 @@
 """ Test suite for the code in msilib """
 import unittest
 import os
-from test.support import run_unittest, import_module
+from test.support import import_module
 msilib = import_module('msilib')
 
 class Test_make_id(unittest.TestCase):
@@ -39,8 +39,5 @@
             msilib.make_id(".s\x82o?*+rt"), "_.s_o___rt")
 
 
-def test_main():
-    run_unittest(__name__)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_nis.py b/Lib/test/test_nis.py
--- a/Lib/test/test_nis.py
+++ b/Lib/test/test_nis.py
@@ -36,8 +36,5 @@
             if done:
                 break
 
-def test_main():
-    support.run_unittest(NisTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py
--- a/Lib/test/test_normalization.py
+++ b/Lib/test/test_normalization.py
@@ -1,4 +1,4 @@
-from test.support import run_unittest, open_urlresource
+from test.support import open_urlresource
 import unittest
 
 from http.client import HTTPException
@@ -97,8 +97,5 @@
         normalize('NFC', '\ud55c\uae00')
 
 
-def test_main():
-    run_unittest(NormalizationTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_numeric_tower.py b/Lib/test/test_numeric_tower.py
--- a/Lib/test/test_numeric_tower.py
+++ b/Lib/test/test_numeric_tower.py
@@ -5,7 +5,6 @@
 import math
 import sys
 import operator
-from test.support import run_unittest
 
 from decimal import Decimal as D
 from fractions import Fraction as F
@@ -199,8 +198,5 @@
                 self.assertRaises(TypeError, op, v, z)
 
 
-def test_main():
-    run_unittest(HashTest, ComparisonTest)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py
--- a/Lib/test/test_opcodes.py
+++ b/Lib/test/test_opcodes.py
@@ -1,6 +1,5 @@
 # Python test set -- part 2, opcodes
 
-from test.support import run_unittest
 import unittest
 
 class OpcodeTest(unittest.TestCase):
@@ -105,8 +104,5 @@
         self.assertEqual(MyString() % 3, 42)
 
 
-def test_main():
-    run_unittest(OpcodeTest)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_openpty.py b/Lib/test/test_openpty.py
--- a/Lib/test/test_openpty.py
+++ b/Lib/test/test_openpty.py
@@ -1,7 +1,6 @@
 # Test to see if openpty works. (But don't worry if it isn't available.)
 
 import os, unittest
-from test.support import run_unittest
 
 if not hasattr(os, "openpty"):
     raise unittest.SkipTest("os.openpty() not available.")
@@ -18,8 +17,5 @@
         os.write(slave, b'Ping!')
         self.assertEqual(os.read(master, 1024), b'Ping!')
 
-def test_main():
-    run_unittest(OpenptyTest)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_osx_env.py b/Lib/test/test_osx_env.py
--- a/Lib/test/test_osx_env.py
+++ b/Lib/test/test_osx_env.py
@@ -2,7 +2,7 @@
 Test suite for OS X interpreter environment variables.
 """
 
-from test.support import EnvironmentVarGuard, run_unittest
+from test.support import EnvironmentVarGuard
 import subprocess
 import sys
 import sysconfig
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -730,16 +730,5 @@
         with self.assertRaises(TypeError):
             parser.expr("a", "b")
 
-def test_main():
-    support.run_unittest(
-        RoundtripLegalSyntaxTestCase,
-        IllegalSyntaxTestCase,
-        CompileTestCase,
-        ParserStackLimitTestCase,
-        STObjectTestCase,
-        OtherParserCase,
-    )
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py
--- a/Lib/test/test_peepholer.py
+++ b/Lib/test/test_peepholer.py
@@ -319,21 +319,5 @@
             f()
 
 
-def test_main(verbose=None):
-    import sys
-    from test import support
-    test_classes = (TestTranforms, TestBuglets)
-    support.run_unittest(*test_classes)
-
-    # verify reference counting
-    if verbose and hasattr(sys, 'gettotalrefcount'):
-        import gc
-        counts = [None] * 5
-        for i in range(len(counts)):
-            support.run_unittest(*test_classes)
-            gc.collect()
-            counts[i] = sys.gettotalrefcount()
-        print(counts)
-
 if __name__ == "__main__":
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_pep247.py b/Lib/test/test_pep247.py
--- a/Lib/test/test_pep247.py
+++ b/Lib/test/test_pep247.py
@@ -6,7 +6,6 @@
 import hmac
 import unittest
 from hashlib import md5, sha1, sha224, sha256, sha384, sha512
-from test import support
 
 class Pep247Test(unittest.TestCase):
 
@@ -63,8 +62,5 @@
     def test_hmac(self):
         self.check_module(hmac, key=b'abc')
 
-def test_main():
-    support.run_unittest(Pep247Test)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pep292.py b/Lib/test/test_pep292.py
--- a/Lib/test/test_pep292.py
+++ b/Lib/test/test_pep292.py
@@ -244,11 +244,5 @@
                          'tim likes to eat a bag of ham worth $100')
 
 
-def test_main():
-    from test import support
-    test_classes = [TestTemplate,]
-    support.run_unittest(*test_classes)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pep3120.py b/Lib/test/test_pep3120.py
--- a/Lib/test/test_pep3120.py
+++ b/Lib/test/test_pep3120.py
@@ -1,7 +1,6 @@
 # This file is marked as binary in the CVS, to prevent MacCVS from recoding it.
 
 import unittest
-from test import support
 
 class PEP3120Test(unittest.TestCase):
 
@@ -40,8 +39,5 @@
         self.assertEqual('Ç', ns['u'])
 
 
-def test_main():
-    support.run_unittest(PEP3120Test, BuiltinCompileTests)
-
-if __name__=="__main__":
-    test_main()
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_pep3131.py b/Lib/test/test_pep3131.py
--- a/Lib/test/test_pep3131.py
+++ b/Lib/test/test_pep3131.py
@@ -1,6 +1,5 @@
 import unittest
 import sys
-from test import support
 
 class PEP3131Test(unittest.TestCase):
 
@@ -28,8 +27,5 @@
         else:
             self.fail("expected exception didn't occur")
 
-def test_main():
-    support.run_unittest(PEP3131Test)
-
-if __name__=="__main__":
-    test_main()
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_pep3151.py b/Lib/test/test_pep3151.py
--- a/Lib/test/test_pep3151.py
+++ b/Lib/test/test_pep3151.py
@@ -7,7 +7,6 @@
 import errno
 from errno import EEXIST
 
-from test import support
 
 class SubOSError(OSError):
     pass
@@ -202,8 +201,5 @@
         self.assertEqual(str(e), '')
 
 
-def test_main():
-    support.run_unittest(__name__)
-
-if __name__=="__main__":
-    test_main()
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_pep380.py b/Lib/test/test_pep380.py
--- a/Lib/test/test_pep380.py
+++ b/Lib/test/test_pep380.py
@@ -1013,11 +1013,5 @@
         self.assertEqual(v, (1, 2, 3, 4))
 
 
-def test_main():
-    from test import support
-    test_classes = [TestPEP380Operation]
-    support.run_unittest(*test_classes)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py
--- a/Lib/test/test_pkg.py
+++ b/Lib/test/test_pkg.py
@@ -291,9 +291,5 @@
         import t8
         self.assertEqual(t8.__doc__, "doc for t8")
 
-def test_main():
-    support.run_unittest(__name__)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pkgimport.py b/Lib/test/test_pkgimport.py
--- a/Lib/test/test_pkgimport.py
+++ b/Lib/test/test_pkgimport.py
@@ -7,7 +7,7 @@
 import unittest
 
 from importlib.util import cache_from_source
-from test.support import run_unittest, create_empty_file
+from test.support import create_empty_file
 
 class TestImport(unittest.TestCase):
 
@@ -76,9 +76,5 @@
         self.assertEqual(getattr(module, var), 1)
 
 
-def test_main():
-    run_unittest(TestImport)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py
--- a/Lib/test/test_popen.py
+++ b/Lib/test/test_popen.py
@@ -57,8 +57,5 @@
         with os.popen("echo hello") as f:
             self.assertEqual(list(f), ["hello\n"])
 
-def test_main():
-    support.run_unittest(PopenTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py
--- a/Lib/test/test_pow.py
+++ b/Lib/test/test_pow.py
@@ -122,8 +122,5 @@
             eq(pow(a, -fiveto), expected)
         eq(expected, 1.0)   # else we didn't push fiveto to evenness
 
-def test_main():
-    test.support.run_unittest(PowTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_property.py b/Lib/test/test_property.py
--- a/Lib/test/test_property.py
+++ b/Lib/test/test_property.py
@@ -3,7 +3,6 @@
 
 import sys
 import unittest
-from test.support import run_unittest
 
 class PropertyBase(Exception):
     pass
@@ -247,8 +246,5 @@
 
 
 
-def test_main():
-    run_unittest(PropertyTests, PropertySubclassTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pstats.py b/Lib/test/test_pstats.py
--- a/Lib/test/test_pstats.py
+++ b/Lib/test/test_pstats.py
@@ -34,12 +34,5 @@
         stats.add(self.stats, self.stats)
 
 
-def test_main():
-    support.run_unittest(
-        AddCallersTestCase,
-        StatsTestCase,
-    )
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py
--- a/Lib/test/test_pty.py
+++ b/Lib/test/test_pty.py
@@ -1,4 +1,4 @@
-from test.support import verbose, run_unittest, import_module, reap_children
+from test.support import verbose, import_module, reap_children
 
 # Skip these tests if termios is not available
 import_module('termios')
@@ -293,11 +293,8 @@
             pty._copy(masters[0])
 
 
-def test_main(verbose=None):
-    try:
-        run_unittest(SmallPtyTests, PtyTest)
-    finally:
-        reap_children()
+def tearDownModule():
+    reap_children()
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pulldom.py b/Lib/test/test_pulldom.py
--- a/Lib/test/test_pulldom.py
+++ b/Lib/test/test_pulldom.py
@@ -6,7 +6,7 @@
 from xml.sax.xmlreader import AttributesImpl
 from xml.dom import pulldom
 
-from test.support import run_unittest, findfile
+from test.support import findfile
 
 
 tstfile = findfile("test.xml", subdir="xmltestdata")
@@ -339,9 +339,5 @@
         doc.unlink()
 
 
-def test_main():
-    run_unittest(PullDOMTestCase, ThoroughTestCase, SAX2DOMTestCase)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py
--- a/Lib/test/test_pwd.py
+++ b/Lib/test/test_pwd.py
@@ -107,8 +107,5 @@
         self.assertRaises(KeyError, pwd.getpwuid, 2**128)
         self.assertRaises(KeyError, pwd.getpwuid, -2**128)
 
-def test_main():
-    support.run_unittest(PwdTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -2,7 +2,6 @@
    Test cases for pyclbr.py
    Nick Mathewson
 '''
-from test.support import run_unittest
 import sys
 from types import FunctionType, MethodType, BuiltinFunctionType
 import pyclbr
@@ -173,9 +172,5 @@
         self.assertRaises(ImportError, pyclbr.readmodule_ex, 'asyncore.foo')
 
 
-def test_main():
-    run_unittest(PyclbrTest)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -10,7 +10,7 @@
 from xml.parsers import expat
 from xml.parsers.expat import errors
 
-from test.support import sortdict, run_unittest
+from test.support import sortdict
 
 
 class SetAttributeTest(unittest.TestCase):
@@ -708,19 +708,5 @@
         self.assertEqual(handler_call_args, [("bar", "baz")])
 
 
-def test_main():
-    run_unittest(SetAttributeTest,
-                 ParseTest,
-                 NamespaceSeparatorTest,
-                 InterningTest,
-                 BufferTextTest,
-                 HandlerExceptionTest,
-                 PositionTest,
-                 sf1296433Test,
-                 ChardataBufferTest,
-                 MalformedInputTest,
-                 ErrorMessageTest,
-                 ForeignDTDTests)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py
--- a/Lib/test/test_queue.py
+++ b/Lib/test/test_queue.py
@@ -354,10 +354,5 @@
         self.failing_queue_test(q)
 
 
-def test_main():
-    support.run_unittest(QueueTest, LifoQueueTest, PriorityQueueTest,
-                              FailingQueueTest)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py
--- a/Lib/test/test_quopri.py
+++ b/Lib/test/test_quopri.py
@@ -1,4 +1,3 @@
-from test import support
 import unittest
 
 import sys, os, io, subprocess
@@ -207,9 +206,5 @@
         p = p.decode('latin-1')
         self.assertEqual(cout.splitlines(), p.splitlines())
 
-def test_main():
-    support.run_unittest(QuopriTestCase)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py
--- a/Lib/test/test_raise.py
+++ b/Lib/test/test_raise.py
@@ -415,8 +415,5 @@
             self.fail("No exception raised")
 
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py
--- a/Lib/test/test_range.py
+++ b/Lib/test/test_range.py
@@ -647,8 +647,5 @@
         with self.assertRaises(AttributeError):
             del rangeobj.step
 
-def test_main():
-    test.support.run_unittest(RangeTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py
--- a/Lib/test/test_readline.py
+++ b/Lib/test/test_readline.py
@@ -4,7 +4,7 @@
 import os
 import tempfile
 import unittest
-from test.support import run_unittest, import_module, unlink
+from test.support import import_module, unlink
 from test.script_helper import assert_python_ok
 
 # Skip tests if there is no readline module
@@ -97,8 +97,5 @@
         self.assertEqual(stdout, b'')
 
 
-def test_main():
-    run_unittest(TestHistoryManipulation, TestReadline)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_richcmp.py b/Lib/test/test_richcmp.py
--- a/Lib/test/test_richcmp.py
+++ b/Lib/test/test_richcmp.py
@@ -326,8 +326,5 @@
             self.assertIs(op(x, y), True)
 
 
-def test_main():
-    support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_rlcompleter.py b/Lib/test/test_rlcompleter.py
--- a/Lib/test/test_rlcompleter.py
+++ b/Lib/test/test_rlcompleter.py
@@ -1,4 +1,3 @@
-from test import support
 import unittest
 import builtins
 import rlcompleter
@@ -65,9 +64,5 @@
                          ['egg.{}('.format(x) for x in dir(str)
                           if x.startswith('s')])
 
-def test_main():
-    support.run_unittest(TestRlcompleter)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -8,7 +8,7 @@
 import importlib, importlib.machinery, importlib.util
 import py_compile
 from test.support import (
-    forget, make_legacy_pyc, run_unittest, unload, verbose, no_tracing,
+    forget, make_legacy_pyc, unload, verbose, no_tracing,
     create_empty_file)
 from test.script_helper import (
     make_pkg, make_script, make_zip_pkg, make_zip_script, temp_dir)
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -1,7 +1,7 @@
 import unittest
 import weakref
 
-from test.support import check_syntax_error, cpython_only, run_unittest
+from test.support import check_syntax_error, cpython_only
 
 
 class ScopeTests(unittest.TestCase):
@@ -757,8 +757,5 @@
         self.assertIsNone(ref())
 
 
-def test_main():
-    run_unittest(ScopeTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -75,9 +75,8 @@
         a[:] = [F()] * 10
         self.assertEqual(select.select([], a, []), ([], a[:5], []))
 
-def test_main():
-    support.run_unittest(SelectTestCase)
+def tearDownModule():
     support.reap_children()
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_shlex.py b/Lib/test/test_shlex.py
--- a/Lib/test/test_shlex.py
+++ b/Lib/test/test_shlex.py
@@ -3,7 +3,6 @@
 import string
 import unittest
 
-from test import support
 
 
 # The original test data set was from shellwords, by Hartmut Goebel.
@@ -195,8 +194,5 @@
         if methname.startswith("test") and methname != "testCompat":
             delattr(ShlexTest, methname)
 
-def test_main():
-    support.run_unittest(ShlexTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -1099,16 +1099,8 @@
                                 (exitcode, stdout))
 
 
-def test_main():
-    try:
-        support.run_unittest(GenericTests, PosixTests, InterProcessSignalTests,
-                             WakeupFDTests, WakeupSignalTests,
-                             WakeupSocketSignalTests,
-                             SiginterruptTest, ItimerTest, WindowsSignalTests,
-                             PendingSignalsTests)
-    finally:
-        support.reap_children()
-
+def tearDownModule():
+    support.reap_children()
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
--- a/Lib/test/test_slice.py
+++ b/Lib/test/test_slice.py
@@ -1,7 +1,6 @@
 # tests for slice objects; in particular the indices method.
 
 import unittest
-from test import support
 from pickle import loads, dumps
 
 import itertools
@@ -240,8 +239,5 @@
             self.assertEqual(s.indices(15), t.indices(15))
             self.assertNotEqual(id(s), id(t))
 
-def test_main():
-    support.run_unittest(SliceTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py
--- a/Lib/test/test_smtpnet.py
+++ b/Lib/test/test_smtpnet.py
@@ -79,8 +79,5 @@
             server.quit()
 
 
-def test_main():
-    support.run_unittest(SmtpTest, SmtpSSLTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py
--- a/Lib/test/test_sort.py
+++ b/Lib/test/test_sort.py
@@ -262,24 +262,5 @@
 
 #==============================================================================
 
-def test_main(verbose=None):
-    test_classes = (
-        TestBase,
-        TestDecorateSortUndecorate,
-        TestBugs,
-    )
-
-    support.run_unittest(*test_classes)
-
-    # verify reference counting
-    if verbose and hasattr(sys, "gettotalrefcount"):
-        import gc
-        counts = [None] * 5
-        for i in range(len(counts)):
-            support.run_unittest(*test_classes)
-            gc.collect()
-            counts[i] = sys.gettotalrefcount()
-        print(counts)
-
 if __name__ == "__main__":
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_startfile.py b/Lib/test/test_startfile.py
--- a/Lib/test/test_startfile.py
+++ b/Lib/test/test_startfile.py
@@ -30,8 +30,5 @@
             startfile(empty)
             startfile(empty, "open")
 
-def test_main():
-    support.run_unittest(TestCase)
-
-if __name__=="__main__":
-    test_main()
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py
--- a/Lib/test/test_string.py
+++ b/Lib/test/test_string.py
@@ -1,5 +1,4 @@
 import unittest, string
-from test import support
 
 
 class ModuleTest(unittest.TestCase):
@@ -182,8 +181,5 @@
         self.assertIn("recursion", str(err.exception))
 
 
-def test_main():
-    support.run_unittest(ModuleTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_stringprep.py b/Lib/test/test_stringprep.py
--- a/Lib/test/test_stringprep.py
+++ b/Lib/test/test_stringprep.py
@@ -2,7 +2,6 @@
 # Since we don't have them, this test checks only a few code points.
 
 import unittest
-from test import support
 
 from stringprep import *
 
@@ -89,8 +88,5 @@
         #     h.update(data)
         #     print p, h.hexdigest()
 
-def test_main():
-    support.run_unittest(StringprepTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_strlit.py b/Lib/test/test_strlit.py
--- a/Lib/test/test_strlit.py
+++ b/Lib/test/test_strlit.py
@@ -32,7 +32,6 @@
 import shutil
 import tempfile
 import unittest
-import test.support
 
 
 TEMPLATE = r"""# coding: %s
@@ -199,8 +198,5 @@
         self.check_encoding("latin9")
 
 
-def test_main():
-    test.support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -578,18 +578,5 @@
             locale.setlocale(locale.LC_TIME, locale_info)
 
 
-def test_main():
-    support.run_unittest(
-        getlang_Tests,
-        LocaleTime_Tests,
-        TimeRETests,
-        StrptimeTests,
-        Strptime12AMPMTests,
-        JulianTests,
-        CalculationTests,
-        CacheTests
-    )
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_strtod.py b/Lib/test/test_strtod.py
--- a/Lib/test/test_strtod.py
+++ b/Lib/test/test_strtod.py
@@ -429,8 +429,5 @@
         for s in test_strings:
             self.check_strtod(s)
 
-def test_main():
-    test.support.run_unittest(StrtodTests)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -660,8 +660,5 @@
         self.assertRaises(StopIteration, next, it)
 
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_structmembers.py b/Lib/test/test_structmembers.py
--- a/Lib/test/test_structmembers.py
+++ b/Lib/test/test_structmembers.py
@@ -140,8 +140,5 @@
             ts.T_USHORT = USHRT_MAX+1
 
 
-def test_main(verbose=None):
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_structseq.py b/Lib/test/test_structseq.py
--- a/Lib/test/test_structseq.py
+++ b/Lib/test/test_structseq.py
@@ -1,7 +1,6 @@
 import os
 import time
 import unittest
-from test import support
 
 
 class StructSeqTest(unittest.TestCase):
@@ -123,8 +122,5 @@
                     self.assertEqual(list(t[start:stop:step]),
                                      L[start:stop:step])
 
-def test_main():
-    support.run_unittest(StructSeqTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py
--- a/Lib/test/test_super.py
+++ b/Lib/test/test_super.py
@@ -2,7 +2,6 @@
 
 import sys
 import unittest
-from test import support
 
 
 class A:
@@ -173,9 +172,5 @@
         self.assertRaises(TypeError, X.meth, c)
 
 
-def test_main():
-    support.run_unittest(TestSuper)
-
-
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py
--- a/Lib/test/test_symtable.py
+++ b/Lib/test/test_symtable.py
@@ -4,7 +4,6 @@
 import symtable
 import unittest
 
-from test import support
 
 
 TEST_CODE = """
@@ -169,8 +168,5 @@
         symbols = symtable.symtable("def f(x): return x", "?", "exec")
 
 
-def test_main():
-    support.run_unittest(SymtableTest)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_sys_setprofile.py b/Lib/test/test_sys_setprofile.py
--- a/Lib/test/test_sys_setprofile.py
+++ b/Lib/test/test_sys_setprofile.py
@@ -3,7 +3,6 @@
 import sys
 import unittest
 
-from test import support
 
 class TestGetProfile(unittest.TestCase):
     def setUp(self):
@@ -373,13 +372,5 @@
     pprint.pprint(capture_events(callable))
 
 
-def test_main():
-    support.run_unittest(
-        TestGetProfile,
-        ProfileHookTestCase,
-        ProfileSimulatorTestCase
-    )
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_syslog.py b/Lib/test/test_syslog.py
--- a/Lib/test/test_syslog.py
+++ b/Lib/test/test_syslog.py
@@ -36,8 +36,5 @@
         syslog.openlog()
         syslog.syslog('test message from python test_syslog')
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py
--- a/Lib/test/test_telnetlib.py
+++ b/Lib/test/test_telnetlib.py
@@ -393,9 +393,5 @@
         self.assertEqual(data, b''.join(want[:-1]))
 
 
-def test_main(verbose=None):
-    support.run_unittest(GeneralTests, ReadTests, WriteTests, OptionTests,
-                         ExpectTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -1278,8 +1278,5 @@
         self.assertFalse(os.path.exists(name))
 
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -252,9 +252,5 @@
             pass
 
 
-def test_main():
-    support.run_unittest(ThreadRunningTests, BarrierTest, LockTests,
-                         TestForkInThread)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_timeit.py b/Lib/test/test_timeit.py
--- a/Lib/test/test_timeit.py
+++ b/Lib/test/test_timeit.py
@@ -5,7 +5,6 @@
 import time
 from textwrap import dedent
 
-from test.support import run_unittest
 from test.support import captured_stdout
 from test.support import captured_stderr
 
@@ -343,8 +342,5 @@
         self.assert_exc_string(error_stringio.getvalue(), 'ZeroDivisionError')
 
 
-def test_main():
-    run_unittest(TestTimeit)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -216,8 +216,5 @@
         self.assertLess(a, b)
         self.assertLess(b, c)
 
-def test_main():
-    support.run_unittest(TupleTest)
-
-if __name__=="__main__":
-    test_main()
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_typechecks.py b/Lib/test/test_typechecks.py
--- a/Lib/test/test_typechecks.py
+++ b/Lib/test/test_typechecks.py
@@ -1,7 +1,6 @@
 """Unit tests for __instancecheck__ and __subclasscheck__."""
 
 import unittest
-from test import support
 
 
 class ABC(type):
@@ -68,9 +67,5 @@
         self.assertEqual(isinstance(42, (SubInt,)), False)
 
 
-def test_main():
-    support.run_unittest(TypeChecksTest)
-
-
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -1,6 +1,6 @@
 # Python test set -- part 6, built-in types
 
-from test.support import run_unittest, run_with_locale
+from test.support import run_with_locale
 import collections
 import pickle
 import locale
@@ -1172,9 +1172,5 @@
             self.assertEqual(ns, ns_roundtrip, pname)
 
 
-def test_main():
-    run_unittest(TypesTests, MappingProxyTests, ClassCreationTests,
-                 SimpleNamespaceTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py
--- a/Lib/test/test_ucn.py
+++ b/Lib/test/test_ucn.py
@@ -233,8 +233,5 @@
         )
 
 
-def test_main():
-    support.run_unittest(UnicodeNamesTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_unary.py b/Lib/test/test_unary.py
--- a/Lib/test/test_unary.py
+++ b/Lib/test/test_unary.py
@@ -1,7 +1,6 @@
 """Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2"""
 
 import unittest
-from test.support import run_unittest
 
 class UnaryOpTestCase(unittest.TestCase):
 
@@ -50,9 +49,5 @@
         self.assertRaises(TypeError, eval, "~2.0")
 
 
-def test_main():
-    run_unittest(UnaryOpTestCase)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -313,12 +313,5 @@
                 self.assertEqual(len(lines), 1,
                                  r"\u%.4x should not be a linebreak" % i)
 
-def test_main():
-    test.support.run_unittest(
-        UnicodeMiscTest,
-        UnicodeMethodsTest,
-        UnicodeFunctionsTest
-    )
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -190,10 +190,5 @@
 
 
 
-def test_main():
-    support.run_unittest(
-        UserDictTest,
-    )
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py
--- a/Lib/test/test_userlist.py
+++ b/Lib/test/test_userlist.py
@@ -58,8 +58,5 @@
         self.assertEqual(u, v)
         self.assertEqual(type(u), type(v))
 
-def test_main():
-    support.run_unittest(UserListTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -12,7 +12,7 @@
 import subprocess
 import sys
 import tempfile
-from test.support import (captured_stdout, captured_stderr, run_unittest,
+from test.support import (captured_stdout, captured_stderr,
                           can_symlink, EnvironmentVarGuard, rmtree)
 import textwrap
 import unittest
@@ -398,8 +398,5 @@
         self.assert_pip_not_installed()
 
 
-def test_main():
-    run_unittest(BasicTest, EnsurePipTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_wait3.py b/Lib/test/test_wait3.py
--- a/Lib/test/test_wait3.py
+++ b/Lib/test/test_wait3.py
@@ -5,7 +5,7 @@
 import time
 import unittest
 from test.fork_wait import ForkWait
-from test.support import run_unittest, reap_children
+from test.support import reap_children
 
 if not hasattr(os, 'fork'):
     raise unittest.SkipTest("os.fork not defined")
@@ -31,9 +31,8 @@
         self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
         self.assertTrue(rusage)
 
-def test_main():
-    run_unittest(Wait3Test)
+def tearDownModule():
     reap_children()
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_wait4.py b/Lib/test/test_wait4.py
--- a/Lib/test/test_wait4.py
+++ b/Lib/test/test_wait4.py
@@ -5,7 +5,7 @@
 import time
 import sys
 from test.fork_wait import ForkWait
-from test.support import run_unittest, reap_children, get_attribute
+from test.support import reap_children, get_attribute
 
 # If either of these do not exist, skip this test.
 get_attribute(os, 'fork')
@@ -31,9 +31,8 @@
         self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
         self.assertTrue(rusage)
 
-def test_main():
-    run_unittest(Wait4Test)
+def tearDownModule():
     reap_children()
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_weakset.py b/Lib/test/test_weakset.py
--- a/Lib/test/test_weakset.py
+++ b/Lib/test/test_weakset.py
@@ -1,5 +1,4 @@
 import unittest
-from test import support
 from weakref import proxy, ref, WeakSet
 import operator
 import copy
@@ -443,8 +442,5 @@
             self.assertLessEqual(n2, n1)
 
 
-def test_main(verbose=None):
-    support.run_unittest(TestWeakSet)
-
 if __name__ == "__main__":
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py
--- a/Lib/test/test_winsound.py
+++ b/Lib/test/test_winsound.py
@@ -246,8 +246,5 @@
     return __have_soundcard_cache
 
 
-def test_main():
-    support.run_unittest(BeepTest, MessageBeepTest, PlaySoundTest)
-
-if __name__=="__main__":
-    test_main()
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_with.py b/Lib/test/test_with.py
--- a/Lib/test/test_with.py
+++ b/Lib/test/test_with.py
@@ -8,7 +8,6 @@
 import unittest
 from collections import deque
 from contextlib import _GeneratorContextManager, contextmanager
-from test.support import run_unittest
 
 
 class MockContextManager(_GeneratorContextManager):
@@ -737,14 +736,5 @@
             self.assertEqual(10, b1)
             self.assertEqual(20, b2)
 
-def test_main():
-    run_unittest(FailureTestCase, NonexceptionalTestCase,
-                 NestedNonexceptionalTestCase, ExceptionalTestCase,
-                 NonLocalFlowControlTestCase,
-                 AssignmentTargetTestCase,
-                 ExitSwallowsExceptionTestCase,
-                 NestedWith)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
--- a/Lib/test/test_wsgiref.py
+++ b/Lib/test/test_wsgiref.py
@@ -658,8 +658,5 @@
         self.assertEqual(side_effects['close_called'], True)
 
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_xdrlib.py b/Lib/test/test_xdrlib.py
--- a/Lib/test/test_xdrlib.py
+++ b/Lib/test/test_xdrlib.py
@@ -1,4 +1,3 @@
-from test import support
 import unittest
 
 import xdrlib
@@ -74,9 +73,5 @@
     def test_uhyper(self):
         self.assertRaisesConversion(self.packer.pack_uhyper, 'string')
 
-def test_main():
-    support.run_unittest(XDRTest)
-    support.run_unittest(ConversionErrorTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_zipimport_support.py b/Lib/test/test_zipimport_support.py
--- a/Lib/test/test_zipimport_support.py
+++ b/Lib/test/test_zipimport_support.py
@@ -238,9 +238,8 @@
             self.assertIn(os.path.normcase(run_name.encode('utf-8')), data)
 
 
-def test_main():
-    test.support.run_unittest(ZipSupportTests)
+def tearDownModule():
     test.support.reap_children()
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -710,16 +710,5 @@
 """
 
 
-def test_main():
-    support.run_unittest(
-        VersionTestCase,
-        ChecksumTestCase,
-        ChecksumBigBufferTestCase,
-        ExceptionTestCase,
-        CompressTestCase,
-        CompressObjectTestCase
-    )
-
 if __name__ == "__main__":
-    unittest.main() # XXX
-    ###test_main()
+    unittest.main()

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list