bpo-45229: Make pickle tests discoverable (GH-28467) (GH-28478)

(cherry picked from commit e6ba992288fdbe71aa808cfb6955f6f99da7e349)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/test/test_pickletools.py b/Lib/test/test_pickletools.py
index f5e9ae4..d37af79 100644
--- a/Lib/test/test_pickletools.py
+++ b/Lib/test/test_pickletools.py
@@ -2,9 +2,10 @@
 import pickletools
 from test import support
 from test.pickletester import AbstractPickleTests
+import doctest
 import unittest
 
-class OptimizedPickleTests(AbstractPickleTests):
+class OptimizedPickleTests(AbstractPickleTests, unittest.TestCase):
 
     def dumps(self, arg, proto=None, **kwargs):
         return pickletools.optimize(pickle.dumps(arg, proto, **kwargs))
@@ -94,11 +95,10 @@ def test__all__(self):
         support.check__all__(self, pickletools, not_exported=not_exported)
 
 
-def test_main():
-    support.run_unittest(OptimizedPickleTests)
-    support.run_unittest(MiscTestCase)
-    support.run_doctest(pickletools)
+def load_tests(loader, tests, pattern):
+    tests.addTest(doctest.DocTestSuite(pickletools))
+    return tests
 
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()