[CMF-checkins] CVS: CMF/CMFCore/tests - test_all.py:1.10

Chris Withers chrisw@nipltd.com
Sun, 10 Feb 2002 09:08:26 -0500


Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv5704

Modified Files:
	test_all.py 
Log Message:
Refactor.

=== CMF/CMFCore/tests/test_all.py 1.9 => 1.10 ===
-import unittest
-from Products.CMFCore.tests import test_ContentTypeRegistry
-from Products.CMFCore.tests import test_PortalFolder
-from Products.CMFCore.tests import test_TypesTool
-from Products.CMFCore.tests import test_ActionsTool
-from Products.CMFCore.tests import test_ActionInformation
-from Products.CMFCore.tests import test_ActionProviderBase
-from Products.CMFCore.tests import test_Expression
-from Products.CMFCore.tests import test_CatalogTool
-from Products.CMFCore.tests import test_DirectoryView
+from unittest import TestSuite, main
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest( test_ContentTypeRegistry.test_suite() )
-    suite.addTest( test_PortalFolder.test_suite() )
-    suite.addTest( test_TypesTool.test_suite() )
-    suite.addTest( test_ActionsTool.test_suite()  )
-    suite.addTest( test_ActionInformation.test_suite() )
-    suite.addTest( test_ActionProviderBase.test_suite() )
-    suite.addTest( test_Expression.test_suite() )
-    suite.addTest( test_CatalogTool.test_suite() )
-    suite.addTest( test_DirectoryView.test_suite() )
+    suite = TestSuite()
+    for name in [
+        'test_ContentTypeRegistry',
+        'test_PortalFolder',
+        'test_TypesTool',
+        'test_ActionsTool',
+        'test_ActionInformation',
+        'test_ActionProviderBase',
+        'test_Expression',
+        'test_CatalogTool',
+        'test_DirectoryView',
+        ]:
+        suite.addTest(
+            __import__(name,globals(),locals()).test_suite()
+            )
     return suite
 
 def run():
-    if hasattr( unittest, 'JUnitTextTestRunner' ):
-        unittest.JUnitTextTestRunner().run( test_suite() )
-    else:
-        unittest.TextTestRunner( verbosity=1 ).run( test_suite() )
+    main(defaultTest='test_suite')
 
 if __name__ == '__main__':
     run()