Commit f4dfe651 authored by Jérome Perrin's avatar Jérome Perrin

Following up c31582, this is a way to count errors as errors when portal cannot

be created and keep readable error messages.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32864 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c92c6deb
......@@ -881,8 +881,8 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
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()
......
......@@ -35,6 +35,15 @@ class _UnexpectedSuccess(Exception):
"""
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 @@ class TestCase(unittest.TestCase):
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 @@ class _TextTestResult(unittest._TextTestResult, TestResult):
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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment