diff --git a/Lib/test/multibytecodec_support.py b/Lib/test/multibytecodec_support.py --- a/Lib/test/multibytecodec_support.py +++ b/Lib/test/multibytecodec_support.py @@ -278,8 +278,7 @@ supmaps = [] codectests = [] - def __init__(self, *args, **kw): - unittest.TestCase.__init__(self, *args, **kw) + def setUp(self): try: self.open_mapping_file().close() # test it to report the error early except (OSError, HTTPException): diff --git a/Lib/test/test_codecmaps_cn.py b/Lib/test/test_codecmaps_cn.py --- a/Lib/test/test_codecmaps_cn.py +++ b/Lib/test/test_codecmaps_cn.py @@ -26,8 +26,6 @@ 'trunk/charset/data/xml/gb-18030-2000.xml' -def test_main(): - support.run_unittest(__name__) - if __name__ == "__main__": - test_main() + support.use_resources = ['urlfetch'] + unittest.main() diff --git a/Lib/test/test_codecmaps_hk.py b/Lib/test/test_codecmaps_hk.py --- a/Lib/test/test_codecmaps_hk.py +++ b/Lib/test/test_codecmaps_hk.py @@ -13,9 +13,6 @@ encoding = 'big5hkscs' mapfileurl = 'http://people.freebsd.org/~perky/i18n/BIG5HKSCS-2004.TXT' -def test_main(): - support.run_unittest(__name__) - if __name__ == "__main__": support.use_resources = ['urlfetch'] - test_main() + unittest.main() diff --git a/Lib/test/test_codecmaps_jp.py b/Lib/test/test_codecmaps_jp.py --- a/Lib/test/test_codecmaps_jp.py +++ b/Lib/test/test_codecmaps_jp.py @@ -60,8 +60,6 @@ mapfileurl = 'http://people.freebsd.org/~perky/i18n/SHIFT_JISX0213.TXT' -def test_main(): - support.run_unittest(__name__) - if __name__ == "__main__": - test_main() + support.use_resources = ['urlfetch'] + unittest.main() diff --git a/Lib/test/test_codecmaps_kr.py b/Lib/test/test_codecmaps_kr.py --- a/Lib/test/test_codecmaps_kr.py +++ b/Lib/test/test_codecmaps_kr.py @@ -37,8 +37,6 @@ pass_enctest = [(b'\\', '\u20a9')] pass_dectest = [(b'\\', '\u20a9')] -def test_main(): - support.run_unittest(__name__) - if __name__ == "__main__": - test_main() + support.use_resources = ['urlfetch'] + unittest.main() diff --git a/Lib/test/test_codecmaps_tw.py b/Lib/test/test_codecmaps_tw.py --- a/Lib/test/test_codecmaps_tw.py +++ b/Lib/test/test_codecmaps_tw.py @@ -27,8 +27,6 @@ (b"\xFFxy", "replace", "\ufffdxy"), ) -def test_main(): - support.run_unittest(__name__) - if __name__ == "__main__": - test_main() + support.use_resources = ['urlfetch'] + unittest.main()