diff --git a/src/OFS/tests/testChownRecursive.py b/src/OFS/tests/testChownRecursive.py
index ab540669f7..77740caa89 100644
--- a/src/OFS/tests/testChownRecursive.py
+++ b/src/OFS/tests/testChownRecursive.py
@@ -59,6 +59,5 @@ def testRecursiveChangeOwnership(self):
def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(TestRecursiveChangeOwnership),
- ))
+ return unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestRecursiveChangeOwnership)
diff --git a/src/OFS/tests/testTraverse.py b/src/OFS/tests/testTraverse.py
index 1dff26d1b7..1ba8819b1b 100644
--- a/src/OFS/tests/testTraverse.py
+++ b/src/OFS/tests/testTraverse.py
@@ -691,8 +691,9 @@ def test_view_doesnt_shadow_attribute():
def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestTraverse))
from Testing.ZopeTestCase import FunctionalDocTestSuite
- suite.addTest(FunctionalDocTestSuite())
- return suite
+
+ return unittest.TestSuite((
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestTraverse),
+ FunctionalDocTestSuite(),
+ ))
diff --git a/src/OFS/tests/test_Uninstalled.py b/src/OFS/tests/test_Uninstalled.py
index c8af731ca2..7ea9937577 100644
--- a/src/OFS/tests/test_Uninstalled.py
+++ b/src/OFS/tests/test_Uninstalled.py
@@ -141,7 +141,8 @@ def test_Broken_instance___getstate___gives_access_to_its_state(self):
def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestsOfBroken))
- suite.addTest(unittest.makeSuite(TestsIntegratedBroken))
- return suite
+ return unittest.TestSuite((
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestsOfBroken),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestsIntegratedBroken),
+ ))
diff --git a/src/Products/Five/browser/tests/pages.txt b/src/Products/Five/browser/tests/pages.txt
index 4c25fa9e81..a8384c0255 100644
--- a/src/Products/Five/browser/tests/pages.txt
+++ b/src/Products/Five/browser/tests/pages.txt
@@ -171,12 +171,12 @@ try to access some protected stuff. Let's not forgot to login again,
of course:
>>> from AccessControl import allow_module
- >>> allow_module('smtpd')
+ >>> allow_module('pprint')
>>> self.logout()
>>> view = self.folder.unrestrictedTraverse('testoid/security.html')
>>> print(view())
NoneType
- smtpd
+ pprint
>>> self.login('manager')
Test pages registered through the directive:
diff --git a/src/Products/Five/browser/tests/security.pt b/src/Products/Five/browser/tests/security.pt
index ca0d13726e..34f380684a 100644
--- a/src/Products/Five/browser/tests/security.pt
+++ b/src/Products/Five/browser/tests/security.pt
@@ -1,5 +1,5 @@
+ pprint nocall:modules/pprint"
+ tal:content="python:pprint.__name__" />
diff --git a/src/Products/Five/browser/tests/test_pages.py b/src/Products/Five/browser/tests/test_pages.py
index 2d4d638e1b..591f277c07 100644
--- a/src/Products/Five/browser/tests/test_pages.py
+++ b/src/Products/Five/browser/tests/test_pages.py
@@ -159,9 +159,10 @@ def test_suite():
from Testing.ZopeTestCase import FunctionalDocFileSuite
from Testing.ZopeTestCase import ZopeDocFileSuite
from Testing.ZopeTestCase import ZopeDocTestSuite
+
return unittest.TestSuite((
ZopeDocTestSuite(),
- unittest.makeSuite(TestPublishTraverse),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestPublishTraverse),
ZopeDocFileSuite('pages.txt', package='Products.Five.browser.tests'),
FunctionalDocFileSuite('pages_ftest.txt',
package='Products.Five.browser.tests'),
diff --git a/src/Products/PageTemplates/tests/testZopePageTemplate.py b/src/Products/PageTemplates/tests/testZopePageTemplate.py
index 5773dd4be3..562efb8f7c 100644
--- a/src/Products/PageTemplates/tests/testZopePageTemplate.py
+++ b/src/Products/PageTemplates/tests/testZopePageTemplate.py
@@ -569,12 +569,15 @@ def read(self):
def test_suite():
return unittest.TestSuite((
- unittest.makeSuite(ZPTRegressions),
- unittest.makeSuite(ZPTUtilsTests),
- unittest.makeSuite(ZPTMacros),
- unittest.makeSuite(ZopePageTemplateFileTests),
- unittest.makeSuite(ZPTUnicodeEncodingConflictResolution),
- unittest.makeSuite(ZPTBrowserTests),
- unittest.makeSuite(PreferredCharsetUnicodeResolverTests),
- unittest.makeSuite(SrcTests),
+ unittest.defaultTestLoader.loadTestsFromTestCase(ZPTRegressions),
+ unittest.defaultTestLoader.loadTestsFromTestCase(ZPTUtilsTests),
+ unittest.defaultTestLoader.loadTestsFromTestCase(ZPTMacros),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ ZopePageTemplateFileTests),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ ZPTUnicodeEncodingConflictResolution),
+ unittest.defaultTestLoader.loadTestsFromTestCase(ZPTBrowserTests),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ PreferredCharsetUnicodeResolverTests),
+ unittest.defaultTestLoader.loadTestsFromTestCase(SrcTests),
))
diff --git a/src/Products/PageTemplates/tests/test_engine.py b/src/Products/PageTemplates/tests/test_engine.py
index 0a09554731..44d4d6b3a8 100644
--- a/src/Products/PageTemplates/tests/test_engine.py
+++ b/src/Products/PageTemplates/tests/test_engine.py
@@ -109,6 +109,4 @@ def test_macros_access(self):
def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(TestPatches),
- ))
+ return unittest.defaultTestLoader.loadTestsFromTestCase(TestPatches)
diff --git a/src/Products/PageTemplates/tests/test_pagetemplate.py b/src/Products/PageTemplates/tests/test_pagetemplate.py
index 89cae1298e..c834bb20e6 100644
--- a/src/Products/PageTemplates/tests/test_pagetemplate.py
+++ b/src/Products/PageTemplates/tests/test_pagetemplate.py
@@ -83,6 +83,5 @@ def test_secure(self):
def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(TestPageTemplateFile),
- ))
+ return unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestPageTemplateFile)
diff --git a/src/Products/PageTemplates/tests/test_persistenttemplate.py b/src/Products/PageTemplates/tests/test_persistenttemplate.py
index ac953ea7ea..ff7b2650b7 100644
--- a/src/Products/PageTemplates/tests/test_persistenttemplate.py
+++ b/src/Products/PageTemplates/tests/test_persistenttemplate.py
@@ -240,6 +240,4 @@ def test_python_nbsp(self):
def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(TestPersistent),
- ))
+ return unittest.defaultTestLoader.loadTestsFromTestCase(TestPersistent)
diff --git a/src/Products/PageTemplates/tests/test_viewpagetemplatefile.py b/src/Products/PageTemplates/tests/test_viewpagetemplatefile.py
index 00b75bd664..d2d450d50d 100644
--- a/src/Products/PageTemplates/tests/test_viewpagetemplatefile.py
+++ b/src/Products/PageTemplates/tests/test_viewpagetemplatefile.py
@@ -87,6 +87,5 @@ def test_processing_instruction(self):
def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(TestPageTemplateFile),
- ))
+ return unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestPageTemplateFile)
diff --git a/src/Testing/ZopeTestCase/testBaseTestCase.py b/src/Testing/ZopeTestCase/testBaseTestCase.py
index 2aa5c09dd1..6749453aac 100644
--- a/src/Testing/ZopeTestCase/testBaseTestCase.py
+++ b/src/Testing/ZopeTestCase/testBaseTestCase.py
@@ -20,6 +20,7 @@
way of getting started.
"""
import gc
+import unittest
import transaction
from AccessControl import getSecurityManager
@@ -451,17 +452,17 @@ def testClearClosesRequest(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestTestCase))
- suite.addTest(makeSuite(TestSetUpRaises))
- suite.addTest(makeSuite(TestTearDownRaises))
- suite.addTest(makeSuite(TestConnectionRegistry))
- suite.addTest(makeSuite(TestApplicationRegistry))
- suite.addTest(makeSuite(TestListConverter))
- suite.addTest(makeSuite(TestRequestVariables))
- suite.addTest(makeSuite(TestRequestGarbage1))
- suite.addTest(makeSuite(TestRequestGarbage2))
- suite.addTest(makeSuite(TestRequestGarbage3))
- return suite
+ return unittest.TestSuite((
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestTestCase),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestSetUpRaises),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestTearDownRaises),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestConnectionRegistry),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestApplicationRegistry),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestListConverter),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestRequestVariables),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestRequestGarbage1),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestRequestGarbage2),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestRequestGarbage3),
+ ))
diff --git a/src/Testing/ZopeTestCase/testFunctional.py b/src/Testing/ZopeTestCase/testFunctional.py
index 5ed7aa7eb4..00581d622a 100644
--- a/src/Testing/ZopeTestCase/testFunctional.py
+++ b/src/Testing/ZopeTestCase/testFunctional.py
@@ -160,8 +160,6 @@ def testSecurityContext(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestFunctional))
- return suite
+ import unittest
+
+ return unittest.defaultTestLoader.loadTestsFromTestCase(TestFunctional)
diff --git a/src/Testing/ZopeTestCase/testInterfaces.py b/src/Testing/ZopeTestCase/testInterfaces.py
index 853d546c6d..5c422ddc01 100644
--- a/src/Testing/ZopeTestCase/testInterfaces.py
+++ b/src/Testing/ZopeTestCase/testInterfaces.py
@@ -13,6 +13,8 @@
"""Interface tests
"""
+import unittest
+
from Testing.ZopeTestCase import Functional
from Testing.ZopeTestCase import FunctionalTestCase
from Testing.ZopeTestCase import PortalTestCase
@@ -91,12 +93,11 @@ def testIPortalSecurity(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestAbstractClasses))
- suite.addTest(makeSuite(TestBaseTestCase))
- suite.addTest(makeSuite(TestZopeTestCase))
- suite.addTest(makeSuite(TestFunctionalTestCase))
- suite.addTest(makeSuite(TestPortalTestCase))
- return suite
+ return unittest.TestSuite((
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestAbstractClasses),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestBaseTestCase),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestZopeTestCase),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestFunctionalTestCase),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestPortalTestCase),
+ ))
diff --git a/src/Testing/ZopeTestCase/testPlaceless.py b/src/Testing/ZopeTestCase/testPlaceless.py
index 0266b3e786..f6dd5a32e8 100644
--- a/src/Testing/ZopeTestCase/testPlaceless.py
+++ b/src/Testing/ZopeTestCase/testPlaceless.py
@@ -13,6 +13,8 @@
"""Placeless setup tests
"""
+import unittest
+
from Testing import ZopeTestCase
from Testing.ZopeTestCase.placeless import setUp
from Testing.ZopeTestCase.placeless import tearDown
@@ -117,8 +119,4 @@ def testDecoratedFuncLoadsZCMLIterable(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestPlacelessSetUp))
- return suite
+ return unittest.defaultTestLoader.loadTestsFromTestCase(TestPlacelessSetUp)
diff --git a/src/Testing/ZopeTestCase/testPortalTestCase.py b/src/Testing/ZopeTestCase/testPortalTestCase.py
index 09fad74451..060953e45f 100644
--- a/src/Testing/ZopeTestCase/testPortalTestCase.py
+++ b/src/Testing/ZopeTestCase/testPortalTestCase.py
@@ -20,6 +20,8 @@
way of getting started.
"""
+import unittest
+
import transaction
from AccessControl import getSecurityManager
from Acquisition import aq_base
@@ -518,11 +520,10 @@ def testTrigger(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestPortalTestCase))
- suite.addTest(makeSuite(TestPlainUserFolder))
- suite.addTest(makeSuite(TestWrappingUserFolder))
- suite.addTest(makeSuite(TestSetUpRaises))
- return suite
+ return unittest.TestSuite((
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestPortalTestCase),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestPlainUserFolder),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestWrappingUserFolder),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestSetUpRaises),
+ ))
diff --git a/src/Testing/ZopeTestCase/testSkeleton.py b/src/Testing/ZopeTestCase/testSkeleton.py
index f3dcab99b4..10e4e871e4 100644
--- a/src/Testing/ZopeTestCase/testSkeleton.py
+++ b/src/Testing/ZopeTestCase/testSkeleton.py
@@ -30,8 +30,6 @@ def testSomething(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestSomeProduct))
- return suite
+ import unittest
+
+ return unittest.defaultTestLoader.loadTestsFromTestCase(TestSomeProduct)
diff --git a/src/Testing/ZopeTestCase/testZODBCompat.py b/src/Testing/ZopeTestCase/testZODBCompat.py
index 4bbadd21b7..a900f9025e 100644
--- a/src/Testing/ZopeTestCase/testZODBCompat.py
+++ b/src/Testing/ZopeTestCase/testZODBCompat.py
@@ -18,6 +18,7 @@
import os
import tempfile
+import unittest
from AccessControl.Permissions import add_documents_images_and_files
from AccessControl.Permissions import delete_objects
@@ -336,12 +337,12 @@ def testTransactionAbort(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestCopyPaste))
- suite.addTest(makeSuite(TestImportExport))
- suite.addTest(makeSuite(TestAttributesOfCleanObjects))
- suite.addTest(makeSuite(TestAttributesOfDirtyObjects))
- suite.addTest(makeSuite(TestTransactionAbort))
- return suite
+ return unittest.TestSuite((
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestCopyPaste),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestImportExport),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestAttributesOfCleanObjects),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestAttributesOfDirtyObjects),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestTransactionAbort),
+ ))
diff --git a/src/Testing/ZopeTestCase/testZopeTestCase.py b/src/Testing/ZopeTestCase/testZopeTestCase.py
index 3b662c625b..3ce3a9fd2e 100644
--- a/src/Testing/ZopeTestCase/testZopeTestCase.py
+++ b/src/Testing/ZopeTestCase/testZopeTestCase.py
@@ -20,6 +20,8 @@
way of getting started.
"""
+import unittest
+
import transaction
from AccessControl import getSecurityManager
from Acquisition import aq_base
@@ -391,10 +393,9 @@ def testLoggedInUserIsWrapped(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestZopeTestCase))
- suite.addTest(makeSuite(TestPlainUserFolder))
- suite.addTest(makeSuite(TestWrappingUserFolder))
- return suite
+ return unittest.TestSuite((
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestZopeTestCase),
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestPlainUserFolder),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ TestWrappingUserFolder),
+ ))
diff --git a/src/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py b/src/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py
index c5d91fa299..38f3bdff44 100644
--- a/src/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py
+++ b/src/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py
@@ -13,8 +13,7 @@
"""Test for auth_header
"""
-from unittest import TestSuite
-from unittest import makeSuite
+import unittest
from Testing.ZopeTestCase import TestCase
from Testing.ZopeTestCase import zopedoctest
@@ -49,6 +48,4 @@ def test_auth_non_encoded_colon(self):
def test_suite():
- return TestSuite((
- makeSuite(AuthHeaderTestCase),
- ))
+ return unittest.defaultTestLoader.loadTestsFromTestCase(AuthHeaderTestCase)
diff --git a/src/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py b/src/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py
index dbc65bc2d0..037f42d678 100644
--- a/src/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py
+++ b/src/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py
@@ -124,7 +124,8 @@ def setUp(self):
def test_suite():
return unittest.TestSuite((
- unittest.makeSuite(HTTPHeaderOutputTests),
+ unittest.defaultTestLoader.loadTestsFromTestCase(
+ HTTPHeaderOutputTests),
FunctionalDocTestSuite(setUp=setUp),
FunctionalDocFileSuite('FunctionalDocTest.txt', setUp=setUp),
))
diff --git a/src/Testing/tests/test_testbrowser.py b/src/Testing/tests/test_testbrowser.py
index 30dd8018aa..7165291454 100644
--- a/src/Testing/tests/test_testbrowser.py
+++ b/src/Testing/tests/test_testbrowser.py
@@ -14,6 +14,7 @@
"""Tests for the testbrowser module.
"""
+import unittest
from urllib.error import HTTPError
import transaction
@@ -192,8 +193,4 @@ def test_headers_camel_case(self):
def test_suite():
- from unittest import TestSuite
- from unittest import makeSuite
- suite = TestSuite()
- suite.addTest(makeSuite(TestTestbrowser))
- return suite
+ return unittest.defaultTestLoader.loadTestsFromTestCase(TestTestbrowser)
diff --git a/src/Zope2/App/tests/test_startup.py b/src/Zope2/App/tests/test_startup.py
index 1332bb5cb3..af85ad5791 100644
--- a/src/Zope2/App/tests/test_startup.py
+++ b/src/Zope2/App/tests/test_startup.py
@@ -74,6 +74,4 @@ def test_interface(self):
def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(StartupTests))
- return suite
+ return unittest.defaultTestLoader.loadTestsFromTestCase(StartupTests)