From 694ed091af3b83b32ef161bd333c042a0ddacc88 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Wed, 19 Dec 2001 16:42:15 +0000 Subject: Fix the test control support for the pickle & cPickle tests so the tests run under regrtest. --- Lib/test/test_cpickle.py | 17 ++++++++++++----- Lib/test/test_pickle.py | 13 ++++++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py index 8047bc5..dda606f 100644 --- a/Lib/test/test_cpickle.py +++ b/Lib/test/test_cpickle.py @@ -1,7 +1,8 @@ import cPickle +import test_support +import unittest from cStringIO import StringIO from pickletester import AbstractPickleTests, AbstractPickleModuleTests -from test_support import run_unittest class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): @@ -79,8 +80,14 @@ class cPickleFastPicklerTests(AbstractPickleTests): AbstractPickleTests.test_recursive_multi, self) +def test_main(): + loader = unittest.TestLoader() + suite = unittest.TestSuite() + suite.addTest(loader.loadTestsFromTestCase(cPickleTests)) + suite.addTest(loader.loadTestsFromTestCase(cPicklePicklerTests)) + suite.addTest(loader.loadTestsFromTestCase(cPickleListPicklerTests)) + suite.addTest(loader.loadTestsFromTestCase(cPickleFastPicklerTests)) + test_support.run_suite(suite) + if __name__ == "__main__": - run_unittest(cPickleTests) - run_unittest(cPicklePicklerTests) - run_unittest(cPickleListPicklerTests) - run_unittest(cPickleFastPicklerTests) + test_main() diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index 06a554e..6265676 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -1,7 +1,8 @@ import pickle +import test_support +import unittest from cStringIO import StringIO from pickletester import AbstractPickleTests, AbstractPickleModuleTests -from test_support import run_unittest class PickleTests(AbstractPickleTests, AbstractPickleModuleTests): @@ -28,6 +29,12 @@ class PicklerTests(AbstractPickleTests): u = pickle.Unpickler(f) return u.load() +def test_main(): + loader = unittest.TestLoader() + suite = unittest.TestSuite() + suite.addTest(loader.loadTestsFromTestCase(PickleTests)) + suite.addTest(loader.loadTestsFromTestCase(PicklerTests)) + test_support.run_suite(suite) + if __name__ == "__main__": - run_unittest(PickleTests) - run_unittest(PicklerTests) + test_main() -- cgit v0.12