[Zope-Checkins] SVN: Zope/trunk/src/Products/Five/browser/tests/test_scriptsecurity.py Made the tests conditional on the presence of PythonScripts

Hanno Schlichting hannosch at hannosch.eu
Sat Jul 10 09:10:05 EDT 2010


Log message for revision 114508:
  Made the tests conditional on the presence of PythonScripts
  

Changed:
  U   Zope/trunk/src/Products/Five/browser/tests/test_scriptsecurity.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/tests/test_scriptsecurity.py
===================================================================
--- Zope/trunk/src/Products/Five/browser/tests/test_scriptsecurity.py	2010-07-10 13:05:35 UTC (rev 114507)
+++ Zope/trunk/src/Products/Five/browser/tests/test_scriptsecurity.py	2010-07-10 13:10:05 UTC (rev 114508)
@@ -1,11 +1,11 @@
 import unittest
 
 from AccessControl import Unauthorized
-from Products.PythonScripts.PythonScript import manage_addPythonScript
 
 
 def addPythonScript(folder, id, params='', body=''):
     """Add a PythonScript to folder."""
+    from Products.PythonScripts.PythonScript import manage_addPythonScript
     # clean up any 'ps' that's already here..
     if id in folder:
         del folder[id]
@@ -179,9 +179,14 @@
 
 
 def test_suite():
-    from Testing.ZopeTestCase import ZopeDocTestSuite
-    from Testing.ZopeTestCase import installProduct
-    installProduct('PythonScripts')
-    return unittest.TestSuite((
-        ZopeDocTestSuite(),
-        ))
+    suite = unittest.TestSuite()
+    try:
+        import Products.PythonScripts
+    except ImportError:
+        pass
+    else:
+        from Testing.ZopeTestCase import ZopeDocTestSuite
+        from Testing.ZopeTestCase import installProduct
+        installProduct('PythonScripts')
+        suite.addTest(unittest.makeSuite(ZopeDocTestSuite()))
+    return suite



More information about the Zope-Checkins mailing list