diff options
34 files changed, 229 insertions, 39 deletions
diff --git a/Lib/test/test_binhex.py b/Lib/test/test_binhex.py index c774200fd8..2580fb21e2 100755 --- a/Lib/test/test_binhex.py +++ b/Lib/test/test_binhex.py @@ -42,4 +42,9 @@ class BinHexTestCase(unittest.TestCase): self.assertEqual(self.DATA, finish) -test_support.run_unittest(BinHexTestCase) +def test_main(): + test_support.run_unittest(BinHexTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_binop.py b/Lib/test/test_binop.py index c64e3a84ea..976e7ffa10 100644 --- a/Lib/test/test_binop.py +++ b/Lib/test/test_binop.py @@ -320,4 +320,9 @@ self.assertEqual(Rat(1, 2) * 3.0, 1.5) self.assertEqual(eval('1/2'), 0.5) """ -test_support.run_unittest(RatTestCase) +def test_main(): + test_support.run_unittest(RatTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py index 529f15b190..886bf18c2b 100644 --- a/Lib/test/test_call.py +++ b/Lib/test/test_call.py @@ -122,4 +122,10 @@ class CFunctionCalls(unittest.TestCase): def test_oldargs1_2_kw(self): self.assertRaises(TypeError, {}.update, x=2, y=2) -run_unittest(CFunctionCalls) + +def test_main(): + run_unittest(CFunctionCalls) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index 6d9e31d672..28d84ce4a6 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -22,4 +22,10 @@ class UTF16Test(unittest.TestCase): f = reader(s) self.assertEquals(f.read(), u"spamspam") -test_support.run_unittest(UTF16Test) + +def test_main(): + test_support.run_unittest(UTF16Test) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py index 7847fb3eef..fbe4a31853 100644 --- a/Lib/test/test_codeop.py +++ b/Lib/test/test_codeop.py @@ -87,4 +87,10 @@ class CodeopTests(unittest.TestCase): self.assertNotEquals(compile_command("a = 1\n", "abc").co_filename, compile("a = 1\n", "def", 'single').co_filename) -run_unittest(CodeopTests) + +def test_main(): + run_unittest(CodeopTests) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_commands.py b/Lib/test/test_commands.py index 54ae676d77..77372c5243 100644 --- a/Lib/test/test_commands.py +++ b/Lib/test/test_commands.py @@ -42,4 +42,10 @@ class CommandTests(unittest.TestCase): self.assert_(re.match(pat, getstatus("/bin/ls"), re.VERBOSE)) -run_unittest(CommandTests) + +def test_main(): + run_unittest(CommandTests) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_copy_reg.py b/Lib/test/test_copy_reg.py index 51ec60b595..0f5c96f10d 100644 --- a/Lib/test/test_copy_reg.py +++ b/Lib/test/test_copy_reg.py @@ -22,4 +22,9 @@ class CopyRegTestCase(unittest.TestCase): type(1), int, "not a callable") -test_support.run_unittest(CopyRegTestCase) +def test_main(): + test_support.run_unittest(CopyRegTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_dircache.py b/Lib/test/test_dircache.py index 6d57dcfde5..95dc2af437 100644 --- a/Lib/test/test_dircache.py +++ b/Lib/test/test_dircache.py @@ -65,4 +65,10 @@ class DircacheTests(unittest.TestCase): dircache.annotate(self.tempdir, lst) self.assertEquals(lst, ['A/', 'test2', 'test_nonexistent']) -run_unittest(DircacheTests) + +def test_main(): + run_unittest(DircacheTests) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_dospath.py b/Lib/test/test_dospath.py index 74bdd4a12a..3cca1597eb 100644 --- a/Lib/test/test_dospath.py +++ b/Lib/test/test_dospath.py @@ -53,4 +53,9 @@ class DOSPathTestCase(unittest.TestCase): self.assertEquals(splitdrive("c:"), ('c:', '')) -test_support.run_unittest(DOSPathTestCase) +def test_main(): + test_support.run_unittest(DOSPathTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_fnmatch.py b/Lib/test/test_fnmatch.py index 9f089267ff..0bd7d6a96c 100644 --- a/Lib/test/test_fnmatch.py +++ b/Lib/test/test_fnmatch.py @@ -38,4 +38,9 @@ class FnmatchTestCase(unittest.TestCase): check('\\', r'[!\]', 0) -test_support.run_unittest(FnmatchTestCase) +def test_main(): + test_support.run_unittest(FnmatchTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_fpformat.py b/Lib/test/test_fpformat.py index 9d20dc991f..d4a5eb25ab 100644 --- a/Lib/test/test_fpformat.py +++ b/Lib/test/test_fpformat.py @@ -66,4 +66,10 @@ class FpformatTest(unittest.TestCase): else: self.fail("No exception on non-numeric sci") -run_unittest(FpformatTest) + +def test_main(): + run_unittest(FpformatTest) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py index 804ae1d68f..8cf6ecf471 100644 --- a/Lib/test/test_glob.py +++ b/Lib/test/test_glob.py @@ -106,4 +106,10 @@ class GlobTests(unittest.TestCase): eq(self.glob('?a?', '*F'), map(self.norm, [os.path.join('aaa', 'zzzF'), os.path.join('aab', 'F')])) -run_unittest(GlobTests) + +def test_main(): + run_unittest(GlobTests) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py index 1edb4173d4..a16a922956 100755 --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -19,4 +19,9 @@ class GroupDatabaseTestCase(unittest.TestCase): entry = grp.getgrnam(self.groups[0][0]) -test_support.run_unittest(GroupDatabaseTestCase) +def test_main(): + test_support.run_unittest(GroupDatabaseTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_hash.py b/Lib/test/test_hash.py index 20ec9a4649..f8a1523cc6 100644 --- a/Lib/test/test_hash.py +++ b/Lib/test/test_hash.py @@ -28,4 +28,9 @@ class HashEqualityTestCase(unittest.TestCase): self.same_hash(float(0.5), complex(0.5, 0.0)) -test_support.run_unittest(HashEqualityTestCase) +def test_main(): + test_support.run_unittest(HashEqualityTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py index 37fab7ced7..f6084cb9a3 100644 --- a/Lib/test/test_iter.py +++ b/Lib/test/test_iter.py @@ -694,4 +694,10 @@ class TestCase(unittest.TestCase): (a, b), (c,) = IteratingSequenceClass(2), {42: 24} self.assertEqual((a, b, c), (0, 1, 42)) -run_unittest(TestCase) + +def test_main(): + run_unittest(TestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 57a831631e..4e2339858c 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -96,4 +96,9 @@ class MaildirTestCase(unittest.TestCase): # XXX We still need more tests! -test_support.run_unittest(MaildirTestCase) +def test_main(): + test_support.run_unittest(MaildirTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_mhlib.py b/Lib/test/test_mhlib.py index 30f8ca3f10..9d5f101f34 100644 --- a/Lib/test/test_mhlib.py +++ b/Lib/test/test_mhlib.py @@ -331,4 +331,10 @@ class MhlibTests(unittest.TestCase): msg.fp.close() del msg -run_unittest(MhlibTests) + +def test_main(): + run_unittest(MhlibTests) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index 9b9d3396ef..8735e278ab 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -39,4 +39,9 @@ class MimeTypesTestCase(unittest.TestCase): ".pyunit") -test_support.run_unittest(MimeTypesTestCase) +def test_main(): + test_support.run_unittest(MimeTypesTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py index 6312d9a295..439d340ce3 100644 --- a/Lib/test/test_operator.py +++ b/Lib/test/test_operator.py @@ -210,4 +210,9 @@ class OperatorTestCase(unittest.TestCase): self.failUnless(operator.xor(0xb, 0xc) == 0x7) -test_support.run_unittest(OperatorTestCase) +def test_main(): + test_support.run_unittest(OperatorTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 9cddb5f700..3f26f2f889 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -62,5 +62,9 @@ class TemporaryFileTests(unittest.TestCase): self.check_tempfile(os.tmpnam()) +def test_main(): + run_unittest(TemporaryFileTests) -run_unittest(TemporaryFileTests) + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index 9e994750c9..966f3e9934 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -353,5 +353,13 @@ class IllegalSyntaxTestCase(unittest.TestCase): self.check_bad_tree(tree, "a $= b") -test_support.run_unittest(RoundtripLegalSyntaxTestCase) -test_support.run_unittest(IllegalSyntaxTestCase) +def test_main(): + loader = unittest.TestLoader() + suite = unittest.TestSuite() + suite.addTest(loader.loadTestsFromTestCase(RoundtripLegalSyntaxTestCase)) + suite.addTest(loader.loadTestsFromTestCase(IllegalSyntaxTestCase)) + test_support.run_suite(suite) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_pkgimport.py b/Lib/test/test_pkgimport.py index 2f1950922f..72889f9708 100644 --- a/Lib/test/test_pkgimport.py +++ b/Lib/test/test_pkgimport.py @@ -75,4 +75,10 @@ class TestImport(unittest.TestCase): reload(module) self.assertEqual(getattr(module, var), 1) -run_unittest(TestImport) + +def test_main(): + run_unittest(TestImport) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py index 34c7a84f02..167b4ac247 100644 --- a/Lib/test/test_pprint.py +++ b/Lib/test/test_pprint.py @@ -76,4 +76,10 @@ class QueryTestCase(unittest.TestCase): verify(native == got, "expected %s got %s from pprint.%s" % (native, got, function)) -test_support.run_unittest(QueryTestCase) + +def test_main(): + test_support.run_unittest(QueryTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py index ce4d8acb34..179b3b5968 100644 --- a/Lib/test/test_pyclbr.py +++ b/Lib/test/test_pyclbr.py @@ -153,4 +153,10 @@ class PyclbrTest(unittest.TestCase): # pdb plays too many dynamic games # cm('pdb', pdb) -run_unittest(PyclbrTest) + +def test_main(): + run_unittest(PyclbrTest) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py index 348f4bc952..0e997271fc 100644 --- a/Lib/test/test_quopri.py +++ b/Lib/test/test_quopri.py @@ -136,4 +136,9 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''') self.assert_(decodestring(e) == p) -test_support.run_unittest(QuopriTestCase) +def test_main(): + test_support.run_unittest(QuopriTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py index cd9675a839..b7d937481d 100644 --- a/Lib/test/test_repr.py +++ b/Lib/test/test_repr.py @@ -265,6 +265,11 @@ class ClassWithFailingRepr: raise Exception("This should be caught by Repr.repr_instance") -run_unittest(ReprTests) -if os.name != 'mac': - run_unittest(LongReprTest) +def test_main(): + run_unittest(ReprTests) + if os.name != 'mac': + run_unittest(LongReprTest) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py index 4040cdb859..ab1746b126 100644 --- a/Lib/test/test_rfc822.py +++ b/Lib/test/test_rfc822.py @@ -177,4 +177,10 @@ class MessageTestCase(unittest.TestCase): self.check('To: User J. Person <person@dom.ain>\n\n', [('User J. Person', 'person@dom.ain')]) -test_support.run_unittest(MessageTestCase) + +def test_main(): + test_support.run_unittest(MessageTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_sha.py b/Lib/test/test_sha.py index bc768095df..cad7780467 100644 --- a/Lib/test/test_sha.py +++ b/Lib/test/test_sha.py @@ -27,4 +27,9 @@ class SHATestCase(unittest.TestCase): "34aa973cd4c4daa4f61eeb2bdbad27316534016f") -test_support.run_unittest(SHATestCase) +def test_main(): + test_support.run_unittest(SHATestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_strop.py b/Lib/test/test_strop.py index 7a32e08707..e26f08fc94 100644 --- a/Lib/test/test_strop.py +++ b/Lib/test/test_strop.py @@ -125,4 +125,9 @@ class Sequence: def __getitem__(self, i): return self.seq[i] -test_support.run_unittest(StropFunctionTestCase) +def test_main(): + test_support.run_unittest(StropFunctionTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 160ce4dbaa..b2a3a28788 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -48,4 +48,9 @@ class TimeTestCase(unittest.TestCase): 999999)) -test_support.run_unittest(TimeTestCase) +def test_main(): + test_support.run_unittest(TimeTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 9f818e1607..1b0a124544 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -37,4 +37,10 @@ class TracebackCases(unittest.TestCase): self.assert_(len(err) == 3) self.assert_(err[1].strip() == "[x for x in x] = x") -run_unittest(TracebackCases) + +def test_main(): + run_unittest(TracebackCases) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_unary.py b/Lib/test/test_unary.py index 01c5f01f9b..0c5dd94cee 100644 --- a/Lib/test/test_unary.py +++ b/Lib/test/test_unary.py @@ -49,4 +49,10 @@ class UnaryOpTestCase(unittest.TestCase): self.assertRaises(TypeError, eval, "~2j") self.assertRaises(TypeError, eval, "~2.0") -run_unittest(UnaryOpTestCase) + +def test_main(): + run_unittest(UnaryOpTestCase) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index fa12a6e8f8..5dfa6ce657 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -2,7 +2,7 @@ import sys import unittest import weakref -from test_support import run_unittest +import test_support class C: @@ -434,5 +434,13 @@ class MappingTestCase(TestBase): self.assert_(d.items() == [('something else', o2)]) -run_unittest(ReferencesTestCase) -run_unittest(MappingTestCase) +def test_main(): + loader = unittest.TestLoader() + suite = unittest.TestSuite() + suite.addTest(loader.loadTestsFromTestCase(ReferencesTestCase)) + suite.addTest(loader.loadTestsFromTestCase(MappingTestCase)) + test_support.run_suite(suite) + + +if __name__ == "__main__": + test_main() diff --git a/Lib/test/test_xmllib.py b/Lib/test/test_xmllib.py index a1c5057e77..9ea5042094 100644 --- a/Lib/test/test_xmllib.py +++ b/Lib/test/test_xmllib.py @@ -27,4 +27,9 @@ class XMLParserTestCase(unittest.TestCase): parser.close() -test_support.run_unittest(XMLParserTestCase) +def test_main(): + test_support.run_unittest(XMLParserTestCase) + + +if __name__ == "__main__": + test_main() |