#! /bin/sh set -v python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h ubject: Issue #21741: Update 147 test modules to use test discovery. I have compared output between pre- and post-patch runs of these tests to make sure there's nothing missing and nothing broken, on both Windows and Linux. The only differences I found were actually tests that were previously *not* run. --- 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 index 40ef1ba..babeb44 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -3885,8 +3885,5 @@ class Oddballs(unittest.TestCase): 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 index 6f73c7f..559a187 100644 --- 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 @@ class FutureTest(unittest.TestCase): ".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 index 0152e9d..1075dec 100644 --- 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 @@ class OpcodeTests(unittest.TestCase): 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 index 5dcadf7..ac6325a 100644 --- a/Lib/test/test__osx_support.py +++ b/Lib/test/test__osx_support.py @@ -273,9 +273,5 @@ class Test_OSXSupport(unittest.TestCase): 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 index 70d2f1c..172bd25 100644 --- a/Lib/test/test_atexit.py +++ b/Lib/test/test_atexit.py @@ -177,9 +177,5 @@ class SubinterpreterTest(unittest.TestCase): 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 index dd62d2e..5093e9d 100644 --- 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 @@ __rlshift__ called __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 index 22d53af..48fcb86 100644 --- 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 @@ class MemoryviewBinASCIITest(BinASCIITest): 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 index 9c4c18e..31dc785 100644 --- a/Lib/test/test_binop.py +++ b/Lib/test/test_binop.py @@ -369,8 +369,5 @@ class OperationOrderTests(unittest.TestCase): 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 index c00ccba..e2b8e0f 100644 --- 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 @@ class CFunctionCalls(unittest.TestCase): 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 index 2e072a9..cd0ab90 100644 --- 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 @@ class TestCgitb(unittest.TestCase): self.assertNotIn('

', 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 index 6226587..4064aef 100644 --- a/Lib/test/test_charmapcodec.py +++ b/Lib/test/test_charmapcodec.py @@ -49,8 +49,5 @@ class CharmapCodecTest(unittest.TestCase): 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 index fcac5c5..6036e36 100644 --- 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 @@ class ClassTests(unittest.TestCase): 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 index 4db6b2b..78ec85a 100644 --- 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 @@ class CMathTests(unittest.TestCase): 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 index 9b17767..3394b39 100644 --- a/Lib/test/test_code_module.py +++ b/Lib/test/test_code_module.py @@ -114,8 +114,5 @@ class TestInteractiveConsole(unittest.TestCase): 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 index 60e69eb..d0e3a15 100644 --- a/Lib/test/test_codecencodings_cn.py +++ b/Lib/test/test_codecencodings_cn.py @@ -83,8 +83,5 @@ class Test_HZ(multibytecodec_support.TestBase, unittest.TestCase): (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 index 25c05b6..bb9be11 100644 --- a/Lib/test/test_codecencodings_hk.py +++ b/Lib/test/test_codecencodings_hk.py @@ -19,8 +19,5 @@ class Test_Big5HKSCS(multibytecodec_support.TestBase, unittest.TestCase): (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 index 8776864..8a3ca70 100644 --- a/Lib/test/test_codecencodings_iso2022.py +++ b/Lib/test/test_codecencodings_iso2022.py @@ -38,8 +38,5 @@ class Test_ISO2022_KR(multibytecodec_support.TestBase, unittest.TestCase): 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 index 4091948..44b63a0 100644 --- a/Lib/test/test_codecencodings_jp.py +++ b/Lib/test/test_codecencodings_jp.py @@ -123,8 +123,5 @@ class Test_SJISX0213(multibytecodec_support.TestBase, unittest.TestCase): 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 index cd7696a..b6a74fb 100644 --- a/Lib/test/test_codecencodings_kr.py +++ b/Lib/test/test_codecencodings_kr.py @@ -66,8 +66,5 @@ class Test_JOHAB(multibytecodec_support.TestBase, unittest.TestCase): (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 index ea6e1c1..9174296 100644 --- a/Lib/test/test_codecencodings_tw.py +++ b/Lib/test/test_codecencodings_tw.py @@ -19,8 +19,5 @@ class Test_Big5(multibytecodec_support.TestBase, unittest.TestCase): (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 index b65423b..509bf5d 100644 --- 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 @@ class CodeopTests(unittest.TestCase): 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 index a663832..471c8da 100644 --- 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 @@ class ComparisonTest(unittest.TestCase): 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 index a667a16..3c6bdef 100644 --- 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 @@ class TestContains(unittest.TestCase): 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 index 498c270..4c19746 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -7,7 +7,6 @@ import abc 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 @@ class TestCopy(unittest.TestCase): 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 index abe0748..52e887c 100644 --- 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 @@ class CopyRegTestCase(unittest.TestCase): 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 index 336ccbe..c630c80 100644 --- a/Lib/test/test_crashers.py +++ b/Lib/test/test_crashers.py @@ -30,9 +30,8 @@ class CrasherTest(unittest.TestCase): 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 index 7be3cc3..8e9c2b4 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -1084,11 +1084,5 @@ class TestUnicode(unittest.TestCase): 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 index 53c9469..d0a2ec9 100644 --- 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 TestClassDecorators(unittest.TestCase): 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 index 48d1cb5..a90bc2b 100644 --- a/Lib/test/test_defaultdict.py +++ b/Lib/test/test_defaultdict.py @@ -5,7 +5,6 @@ import copy import pickle import tempfile import unittest -from test import support from collections import defaultdict @@ -184,8 +183,5 @@ class TestDefaultDict(unittest.TestCase): 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 index c96d000..9553c66 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -949,12 +949,5 @@ class Dict(dict): 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 index 7b02ea9..280353a 100644 --- 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 @@ class DictSetTest(unittest.TestCase): 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 index 4f30183..7890b1f 100644 --- 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 index d9fd917..e6ca961 100644 --- a/Lib/test/test_docxmlrpc.py +++ b/Lib/test/test_docxmlrpc.py @@ -213,8 +213,5 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): 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 index 6ec5da3..a0c2972 100644 --- a/Lib/test/test_dummy_threading.py +++ b/Lib/test/test_dummy_threading.py @@ -56,9 +56,5 @@ class DummyThreadingTestCase(unittest.TestCase): 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 index beb7b1c..5080ec9 100644 --- a/Lib/test/test_dynamic.py +++ b/Lib/test/test_dynamic.py @@ -4,7 +4,7 @@ import builtins 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 @@ class RebindBuiltinsTests(unittest.TestCase): 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 index bc6a39b..9f694d9 100644 --- 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 @@ class PropertySubclassTests(unittest.TestCase): -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 index 759168e..7e5ea68 100644 --- a/Lib/test/test_ensurepip.py +++ b/Lib/test/test_ensurepip.py @@ -342,4 +342,4 @@ class TestUninstallationMainFunction(EnsurepipMixin, unittest.TestCase): if __name__ == "__main__": - test.support.run_unittest(__name__) + unittest.main() diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py index e85254c..2630cf2 100644 --- a/Lib/test/test_enumerate.py +++ b/Lib/test/test_enumerate.py @@ -258,16 +258,5 @@ class TestLongStart(EnumerateStartTestCase): (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 index 52e7932..7baa7ae 100644 --- a/Lib/test/test_eof.py +++ b/Lib/test/test_eof.py @@ -24,8 +24,5 @@ class EOFTestCase(unittest.TestCase): 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 index d727403..a7359e9 100644 --- a/Lib/test/test_epoll.py +++ b/Lib/test/test_epoll.py @@ -252,8 +252,5 @@ class TestEPoll(unittest.TestCase): self.assertEqual(os.get_inherita