[CMF-checkins] SVN: CMF/branches/1.6/CMFCore/exportimport/tests/test_actions.py Add BBB to omit tests for export / import of Action and ActionCategory objects.

Tres Seaver tseaver at palladion.com
Fri Nov 18 08:33:29 EST 2005


Log message for revision 40212:
  Add BBB to omit tests for export / import of Action and ActionCategory objects.

Changed:
  U   CMF/branches/1.6/CMFCore/exportimport/tests/test_actions.py

-=-
Modified: CMF/branches/1.6/CMFCore/exportimport/tests/test_actions.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/tests/test_actions.py	2005-11-18 13:28:29 UTC (rev 40211)
+++ CMF/branches/1.6/CMFCore/exportimport/tests/test_actions.py	2005-11-18 13:33:28 UTC (rev 40212)
@@ -24,6 +24,13 @@
 from Products.CMFCore.tests.base.testcase import PlacelessSetup
 from Products.GenericSetup.testing import NodeAdapterTestCase
 
+try: # BBB;  CMF < 2.0 doesn't have Action or ActionCategory objects
+    from Products.CMFCore.ActionInformation import Action
+    from Products.CMFCore.ActionInformation import ActionCategory
+except ImportError: # no such beast
+    _HAVE_ACTION_OBJECTS = False
+else:
+    _HAVE_ACTION_OBJECTS = True
 
 _ACTION_XML = """\
 <object name="foo_action" meta_type="CMF Action">
@@ -101,7 +108,6 @@
         self.assertEqual(obj.visible, True)
 
     def setUp(self):
-        from Products.CMFCore.ActionInformation import Action
         import Products.CMFCore.exportimport
         import Products.Five
         from Products.Five import zcml
@@ -132,7 +138,6 @@
         self.assertEqual(obj.title, '')
 
     def setUp(self):
-        from Products.CMFCore.ActionInformation import ActionCategory
         import Products.CMFCore.exportimport
         import Products.Five
         from Products.Five import zcml
@@ -185,11 +190,12 @@
 
 
 def test_suite():
-    return unittest.TestSuite((
-        unittest.makeSuite(ActionNodeAdapterTests),
-        unittest.makeSuite(ActionCategoryNodeAdapterTests),
-        unittest.makeSuite(ActionsToolNodeAdapterTests),
-        ))
+    suite = unittest.TestSuite()
+    if _HAVE_ACTION_OBJECTS:
+        suite.addTest(unittest.makeSuite(ActionNodeAdapterTests))
+        suite.addTest(unittest.makeSuite(ActionCategoryNodeAdapterTests))
+        suite.addTest(unittest.makeSuite(ActionsToolNodeAdapterTests))
+    return suite
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')



More information about the CMF-checkins mailing list