[Erp5-report] r32864 jerome - /erp5/trunk/products/ERP5Type/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 19 14:55:57 CET 2010


Author: jerome
Date: Fri Feb 19 14:55:56 2010
New Revision: 32864

URL: http://svn.erp5.org?rev=32864&view=rev
Log:
Following up c31582, this is a way to count errors as errors when portal cannot
be created and keep readable error messages.

Modified:
    erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
    erp5/trunk/products/ERP5Type/tests/backportUnittest.py

Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=32864&r1=32863&r2=32864&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Fri Feb 19 14:55:56 2010
@@ -881,8 +881,8 @@
       title = self.getTitle()
       from Products.ERP5Type.Base import _aq_reset
       if portal_name in failed_portal_installation:
-        raise backportUnittest.SkipTest('Installation of %s already failed, giving up'
-                              % portal_name)
+        raise backportUnittest.SetupSiteError(
+            'Installation of %s already failed, giving up' % portal_name)
       try:
         if app is None:
           app = ZopeTestCase.app()

Modified: erp5/trunk/products/ERP5Type/tests/backportUnittest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/backportUnittest.py?rev=32864&r1=32863&r2=32864&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/backportUnittest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/backportUnittest.py [utf8] Fri Feb 19 14:55:56 2010
@@ -34,6 +34,15 @@
   The test was supposed to fail, but it didn't!
   """
   pass
+
+class SetupSiteError(Exception):
+    """
+    The ERP5 Site could not have been setup.
+    This is raised when the site could not have been created in a previous
+    test. We want this to count as an error, but we do not want this to happear
+    in traceback for readability.
+    """
+    pass
 
 def _id(obj):
     return obj
@@ -127,6 +136,8 @@
                 self.setUp()
             except SkipTest, e:
                 result.addSkip(self, str(e))
+            except SetupSiteError, e:
+                result.errors.append(None)
             except Exception:
                 result.addError(self, sys.exc_info())
             else:
@@ -225,6 +236,13 @@
             self.stream.write("u")
             self.stream.flush()
 
+    def printErrors(self):
+        if self.dots or self.showAll:
+            self.stream.writeln()
+        # 'None' correspond to redundant errors due to site creation errors,
+        # and we do not display them here.
+        self.printErrorList('ERROR', filter(None, self.errors))
+        self.printErrorList('FAIL', self.failures)
 
 class TextTestRunner(unittest.TextTestRunner):
     def _makeResult(self):




More information about the Erp5-report mailing list