diff options
Diffstat (limited to 'Lib/test')
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('</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 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_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 index 058dcb9..5c437e9 100644 --- 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 @@ class ErrorcodeTests(unittest.TestCase): '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 index 11f5e5c..d874b0e 100644 --- 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 @@ class ExceptionTestCase(unittest.TestCase): 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 index 65a4369..f1efd26 100644 --- a/Lib/test/test_file_eintr.py +++ b/Lib/test/test_file_eintr.py @@ -13,7 +13,6 @@ import select import signal import subprocess import sys -from test.support import run_unittest import time import unittest @@ -249,12 +248,5 @@ class PyTestTextIOSignalInterrupt(TestTextIOSignalInterrupt, unittest.TestCase): 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 index 03ac1aa..35d7913 100644 --- a/Lib/test/test_finalization.py +++ b/Lib/test/test_finalization.py @@ -515,8 +515,5 @@ class LegacyFinalizationTest(TestBase, unittest.TestCase): 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 index e87aab0..071d217 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -1299,18 +1299,5 @@ class HexFloatTestCase(unittest.TestCase): 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 index 5a709bc..98b5bd6 100644 --- a/Lib/test/test_flufl.py +++ b/Lib/test/test_flufl.py @@ -18,10 +18,5 @@ class FLUFLTests(unittest.TestCase): '<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 index 482835d..fa37f90 100644 --- 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 @@ class FilterTestCase(unittest.TestCase): 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 index 8bcbd46..eeba306 100644 --- a/Lib/test/test_fork1.py +++ b/Lib/test/test_fork1.py @@ -8,7 +8,7 @@ import sys 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 @@ class ForkTest(ForkWait): 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 index e86d5ce..2dd528f 100644 --- 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 @@ class FractionTest(unittest.TestCase): 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 index c402ec3..189fca9 100644 --- a/Lib/test/test_frame.py +++ b/Lib/test/test_frame.py @@ -161,8 +161,5 @@ class FrameLocalsTest(unittest.TestCase): 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 index 5094f7b..8f481bb 100644 --- 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 @@ class BuiltinFunctionPropertiesTest(unittest.TestCase): 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 index c549ac4..e7f34cc 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1584,32 +1584,5 @@ class TestSingleDispatch(unittest.TestCase): 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 index fa5701f..9275dc4 100644 --- a/Lib/test/test_getopt.py +++ b/Lib/test/test_getopt.py @@ -1,7 +1,7 @@ # test_getopt.py # David Goodger <dgoodger@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 @@ class GetoptTests(unittest.TestCase): 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 index 7069fb9..0c65858 100644 --- 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 @@ class GrammarTests(unittest.TestCase): 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 index 749041c..272b086 100644 --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -92,8 +92,5 @@ class GroupDatabaseTestCase(unittest.TestCase): 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 index cde56fd..98826b5 100644 --- a/Lib/test/test_hmac.py +++ b/Lib/test/test_hmac.py @@ -493,14 +493,5 @@ class CompareDigestTestCase(unittest.TestCase): 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 index d6f0ae8..839e0a4 100644 --- a/Lib/test/test_html.py +++ b/Lib/test/test_html.py @@ -4,7 +4,6 @@ Tests for the html module functions. 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 index e94602e..cb57f15 100644 --- a/Lib/test/test_int.py +++ b/Lib/test/test_int.py @@ -451,8 +451,5 @@ class IntTestCases(unittest.TestCase): 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 index 1d578a7..bf72571 100644 --- a/Lib/test/test_int_literal.py +++ b/Lib/test/test_int_literal.py @@ -4,7 +4,6 @@ This is complex because of changes due to PEP 237. """ import unittest -from test import support class TestHexOctBin(unittest.TestCase): @@ -140,8 +139,5 @@ class TestHexOctBin(unittest.TestCase): 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 index efe9f51..b82b651 100644 --- 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 index 7a6730e..e087ac0 100644 --- 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 @@ def blowstack(fxn, arg, compare_to): 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 index 7f315d4..d82e33d 100644 --- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -4,7 +4,6 @@ __author__ = "Jiwon Seo" __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 @@ class KeywordOnlyArgTestCase(unittest.TestCase): 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 index 2585ca6..f822024 100644 --- a/Lib/test/test_kqueue.py +++ b/Lib/test/test_kqueue.py @@ -9,7 +9,6 @@ import sys 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 @@ class TestKQueue(unittest.TestCase): 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 index 3b94700..ae1be6e 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -108,20 +108,5 @@ class ListTest(list_tests.CommonTest): 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 index 57847d8..e025716 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -1241,8 +1241,5 @@ class LongTest(unittest.TestCase): 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 index 1b40d02..f4c463a 100644 --- 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 @@ class LongExpText(unittest.TestCase): 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 index a4cd09c..22b2fcc 100644 --- a/Lib/test/test_mailcap.py +++ b/Lib/test/test_mailcap.py @@ -213,9 +213,5 @@ class FindmatchTest(unittest.TestCase): 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 index 77749e7..3f9928b 100644 --- a/Lib/test/test_memoryio.py +++ b/Lib/test/test_memoryio.py @@ -826,10 +826,5 @@ class CStringIOPickleTest(PyStringIOPickleTest): 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 index e9bd9fd..6fe61a4 100644 --- a/Lib/test/test_memoryview.py +++ b/Lib/test/test_memoryview.py @@ -492,8 +492,5 @@ class ArrayMemorySliceSliceTest(unittest.TestCase, 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 index 0b53032..6856593 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -101,11 +101,5 @@ class Win32MimeTypesTestCase(unittest.TestCase): 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 index 05df6e9..686638c 100644 --- 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 @@ class MinidomTest(unittest.TestCase): 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 index 9da3536..270ec7e 100644 --- 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 @@ a = A(destroyed)""" # 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 index ccdaec7..8ef334f 100644 --- 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 @@ class Test_make_id(unittest.TestCase): 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 index a3a3c26..387a4e7 100644 --- a/Lib/test/test_nis.py +++ b/Lib/test/test_nis.py @@ -36,8 +36,5 @@ class NisTests(unittest.TestCase): 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 index 5dac5db..30fa612 100644 --- 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 @@ class NormalizationTest(unittest.TestCase): 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 index 3423d4e..c54dedb 100644 --- a/Lib/test/test_numeric_tower.py +++ b/Lib/test/test_numeric_tower.py @@ -5,7 +5,6 @@ import random 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 @@ class ComparisonTest(unittest.TestCase): 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 index f510bac..6ef93d9 100644 --- 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 @@ class OpcodeTest(unittest.TestCase): 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 index 4785107..3f46a60 100644 --- 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 @@ class OpenptyTest(unittest.TestCase): 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 index d8eb981..8a3bc5a 100644 --- 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 index e7968cc..2112821 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -730,16 +730,5 @@ class OtherParserCase(unittest.TestCase): 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 index 5025792..41e5091 100644 --- a/Lib/test/test_peepholer.py +++ b/Lib/test/test_peepholer.py @@ -319,21 +319,5 @@ class TestBuglets(unittest.TestCase): 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 index b85a26a..ab5f4189 100644 --- a/Lib/test/test_pep247.py +++ b/Lib/test/test_pep247.py @@ -6,7 +6,6 @@ for hashing algorithms 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 @@ class Pep247Test(unittest.TestCase): 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 index fd5256c..1e5e227 100644 --- a/Lib/test/test_pep292.py +++ b/Lib/test/test_pep292.py @@ -244,11 +244,5 @@ class TestTemplate(unittest.TestCase): '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 index 5b63998..97dced8 100644 --- 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 @@ class BuiltinCompileTests(unittest.TestCase): 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 index 2e6b90a..0679845 100644 --- 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 @@ class PEP3131Test(unittest.TestCase): 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 index 7d4a5d8..8d560cd 100644 --- a/Lib/test/test_pep3151.py +++ b/Lib/test/test_pep3151.py @@ -7,7 +7,6 @@ import unittest import errno from errno import EEXIST -from test import support class SubOSError(OSError): pass @@ -202,8 +201,5 @@ class ExplicitSubclassingTest(unittest.TestCase): 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 index 69194df..23ffbed 100644 --- a/Lib/test/test_pep380.py +++ b/Lib/test/test_pep380.py @@ -1013,11 +1013,5 @@ class TestPEP380Operation(unittest.TestCase): 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 index 9883000..532e8fe 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -291,9 +291,5 @@ class TestPkg(unittest.TestCase): 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 index 370b2aa..5d9a451 100644 --- a/Lib/test/test_pkgimport.py +++ b/Lib/test/test_pkgimport.py @@ -7,7 +7,7 @@ import tempfile 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 @@ class TestImport(unittest.TestCase): 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 index 225e41f..8958db0 100644 --- a/Lib/test/test_popen.py +++ b/Lib/test/test_popen.py @@ -57,8 +57,5 @@ class PopenTest(unittest.TestCase): 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 index 20b1066..6feac40 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -122,8 +122,5 @@ class PowTest(unittest.TestCase): 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 index cee7203..e72eb55 100644 --- 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 @@ class PropertySubclassTests(unittest.TestCase): -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 index 9ebeebb..566b3ea 100644 --- a/Lib/test/test_pstats.py +++ b/Lib/test/test_pstats.py @@ -34,12 +34,5 @@ class StatsTestCase(unittest.TestCase): 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 index 9b783c3..ef5e99e 100644 --- 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 @@ class SmallPtyTests(unittest.TestCase): 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 index b81a595..1932c6b 100644 --- a/Lib/test/test_pulldom.py +++ b/Lib/test/test_pulldom.py @@ -6,7 +6,7 @@ import xml.sax 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 @@ class SAX2DOMTestCase(unittest.TestCase): 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 index 37a1bcb..b7b1a4a 100644 --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -107,8 +107,5 @@ class PwdTest(unittest.TestCase): 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 index 39eb65f..cab430b 100644 --- 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 @@ class PyclbrTest(TestCase): 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 index c233bc1..08e95c6 100644 --- a/Lib/test/test_pyexpat.py +++ b/Lib/test/test_pyexpat.py @@ -10,7 +10,7 @@ import traceback 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 @@ class ForeignDTDTests(unittest.TestCase): 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 index 2cdfee4..4ccaa39 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -354,10 +354,5 @@ class FailingQueueTest(BlockingTestMixin, unittest.TestCase): 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 index 92511fa..7cac013 100644 --- 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 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''') 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 index be5c1c6..a41b353 100644 --- a/Lib/test/test_raise.py +++ b/Lib/test/test_raise.py @@ -415,8 +415,5 @@ class TestRemovedFunctionality(unittest.TestCase): 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 index 2dbcebc..106c732 100644 --- a/Lib/test/test_range.py +++ b/Lib/test/test_range.py @@ -647,8 +647,5 @@ class RangeTest(unittest.TestCase): 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 index 23d6194..e2063b1 100644 --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -4,7 +4,7 @@ Very minimal unittests for parts of the readline module. 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 @@ class TestReadline(unittest.TestCase): 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 index 0b629dc..94185a4 100644 --- a/Lib/test/test_richcmp.py +++ b/Lib/test/test_richcmp.py @@ -326,8 +326,5 @@ class ListTest(unittest.TestCase): 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 index 11a7bd2..9d4d0bd 100644 --- 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 @@ class TestRlcompleter(unittest.TestCase): ['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 index 3884734..81caff8 100644 --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -8,7 +8,7 @@ import tempfile 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 index b325545..4239b26 100644 --- 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 @@ class ScopeTests(unittest.TestCase): 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 index 8f9a1c9..a973f3f 100644 --- a/Lib/test/test_select.py +++ b/Lib/test/test_select.py @@ -75,9 +75,8 @@ class SelectTestCase(unittest.TestCase): 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 index d2809ae..4fafdd4 100644 --- a/Lib/test/test_shlex.py +++ b/Lib/test/test_shlex.py @@ -3,7 +3,6 @@ import shlex import string import unittest -from test import support # The original test data set was from shellwords, by Hartmut Goebel. @@ -195,8 +194,5 @@ if not getattr(shlex, "split", None): 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 index 65b36de..a396331 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -1099,16 +1099,8 @@ class PendingSignalsTests(unittest.TestCase): (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 index 9203d5e..d885776 100644 --- 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 @@ class SliceTest(unittest.TestCase): 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 index 15654f2..cc9bab4 100644 --- a/Lib/test/test_smtpnet.py +++ b/Lib/test/test_smtpnet.py @@ -79,8 +79,5 @@ class SmtpSSLTest(unittest.TestCase): 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 index 8f6af64..a5d0ebf 100644 --- a/Lib/test/test_sort.py +++ b/Lib/test/test_sort.py @@ -262,24 +262,5 @@ class TestDecorateSortUndecorate(unittest.TestCase): #============================================================================== -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 index 43abf9b..f59252e 100644 --- a/Lib/test/test_startfile.py +++ b/Lib/test/test_startfile.py @@ -30,8 +30,5 @@ class TestCase(unittest.TestCase): 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 index f8731b8..85b5434 100644 --- 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 @@ class ModuleTest(unittest.TestCase): 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 index e763635..d4b4a13 100644 --- 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 @@ class StringprepTests(unittest.TestCase): # 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 index d01322f..87cffe8 100644 --- a/Lib/test/test_strlit.py +++ b/Lib/test/test_strlit.py @@ -32,7 +32,6 @@ import sys import shutil import tempfile import unittest -import test.support TEMPLATE = r"""# coding: %s @@ -199,8 +198,5 @@ class TestLiterals(unittest.TestCase): 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 index 2a6f3f8..346e2c6 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -578,18 +578,5 @@ class CacheTests(unittest.TestCase): 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 index 41b6e5f..2727514 100644 --- a/Lib/test/test_strtod.py +++ b/Lib/test/test_strtod.py @@ -429,8 +429,5 @@ class StrtodTests(unittest.TestCase): 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 index 0107eeb..efbdbfc 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -660,8 +660,5 @@ class UnpackIteratorTest(unittest.TestCase): 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 index 1c931ae..57ec45f 100644 --- a/Lib/test/test_structmembers.py +++ b/Lib/test/test_structmembers.py @@ -140,8 +140,5 @@ class TestWarnings(unittest.TestCase): 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 index 353d0ea..3ecb27d 100644 --- 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 @@ class StructSeqTest(unittest.TestCase): 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 index 37fc2d9..dc3a15f 100644 --- 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 @@ class TestSuper(unittest.TestCase): 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 index 335b4dc..e5e7b83 100644 --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -4,7 +4,6 @@ Test the API of the symtable module. import symtable import unittest -from test import support TEST_CODE = """ @@ -169,8 +168,5 @@ class SymtableTest(unittest.TestCase): 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 index e59320b..bb71acd 100644 --- a/Lib/test/test_sys_setprofile.py +++ b/Lib/test/test_sys_setprofile.py @@ -3,7 +3,6 @@ import pprint import sys import unittest -from test import support class TestGetProfile(unittest.TestCase): def setUp(self): @@ -373,13 +372,5 @@ def show_events(callable): 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 index b7fd2bd..6f902f1 100644 --- a/Lib/test/test_syslog.py +++ b/Lib/test/test_syslog.py @@ -36,8 +36,5 @@ class Test(unittest.TestCase): 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 index e1ef99a..524bba3 100644 --- a/Lib/test/test_telnetlib.py +++ b/Lib/test/test_telnetlib.py @@ -393,9 +393,5 @@ class ExpectTests(ExpectAndReadTestCase): 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 index 576cf4d..03c0daa 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -1278,8 +1278,5 @@ class TestTemporaryDirectory(BaseTestCase): 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 index 6144901..ef3059b 100644 --- a/Lib/test/test_thread.py +++ b/Lib/test/test_thread.py @@ -252,9 +252,5 @@ class TestForkInThread(unittest.TestCase): 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 index eebad18..83c93f7 100644 --- a/Lib/test/test_timeit.py +++ b/Lib/test/test_timeit.py @@ -5,7 +5,6 @@ import io 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 @@ class TestTimeit(unittest.TestCase): 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 index d711116..fb113ab 100644 --- a/Lib/test/test_tuple.py +++ b/Lib/test/test_tuple.py @@ -216,8 +216,5 @@ class TupleTest(seq_tests.CommonTest): 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 index 17cd5d3..a0e617b 100644 --- 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 @@ class TypeChecksTest(unittest.TestCase): 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 index 11d9546..8cdecb0 100644 --- 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 @@ class SimpleNamespaceTests(unittest.TestCase): 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 index 1e07f66..8febf0a 100644 --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@ -233,8 +233,5 @@ class UnicodeNamesTest(unittest.TestCase): ) -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 index b835564..c3c17cc 100644 --- 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 @@ class UnaryOpTestCase(unittest.TestCase): 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 index f8788a0..7095767 100644 --- a/Lib/test/test_unicodedata.py +++ b/Lib/test/test_unicodedata.py @@ -313,12 +313,5 @@ class UnicodeMiscTest(UnicodeDatabaseTest): 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 index 2ca9929..c83cc55 100644 --- a/Lib/test/test_userdict.py +++ b/Lib/test/test_userdict.py @@ -190,10 +190,5 @@ class UserDictTest(mapping_tests.TestHashMappingProtocol): -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 index 6381070..4a304df 100644 --- a/Lib/test/test_userlist.py +++ b/Lib/test/test_userlist.py @@ -58,8 +58,5 @@ class UserListTest(list_tests.CommonTest): 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 index b462588..9207a68 100644 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -12,7 +12,7 @@ import struct 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 @@ class EnsurePipTest(BaseTest): 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 index bb71481..eb51b2c 100644 --- a/Lib/test/test_wait3.py +++ b/Lib/test/test_wait3.py @@ -5,7 +5,7 @@ import os 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 @@ class Wait3Test(ForkWait): 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 index b427a9b..43869be 100644 --- a/Lib/test/test_wait4.py +++ b/Lib/test/test_wait4.py @@ -5,7 +5,7 @@ import os 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 @@ class Wait4Test(ForkWait): 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 index fb22879..9ce672b 100644 --- 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 @@ class TestWeakSet(unittest.TestCase): 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 index 83618b6..7afb24b 100644 --- a/Lib/test/test_winsound.py +++ b/Lib/test/test_winsound.py @@ -246,8 +246,5 @@ def _have_soundcard(): 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 index 7068a80..fcd28f6 100644 --- a/Lib/test/test_with.py +++ b/Lib/test/test_with.py @@ -8,7 +8,6 @@ import sys import unittest from collections import deque from contextlib import _GeneratorContextManager, contextmanager -from test.support import run_unittest class MockContextManager(_GeneratorContextManager): @@ -737,14 +736,5 @@ class NestedWith(unittest.TestCase): 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 index 29f64f3..112a1b9 100644 --- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -658,8 +658,5 @@ class HandlerTests(TestCase): 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 index 70496d6..3df5f26 100644 --- 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 @@ class ConversionErrorTest(unittest.TestCase): 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 index 2e801a8..ed4c242 100644 --- a/Lib/test/test_zipimport_support.py +++ b/Lib/test/test_zipimport_support.py @@ -238,9 +238,8 @@ class ZipSupportTests(unittest.TestCase): 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 index 1daa8f8..bd935ed 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -710,16 +710,5 @@ LAERTES """ -def test_main(): - support.run_unittest( - VersionTestCase, - ChecksumTestCase, - ChecksumBigBufferTestCase, - ExceptionTestCase, - CompressTestCase, - CompressObjectTestCase - ) - if __name__ == "__main__": - unittest.main() # XXX - ###test_main() + unittest.main() |