Commit 682ad706 authored by Jérome Perrin's avatar Jérome Perrin

if installing a business template fails, reraise the error and keep a flag not

to try installing it again for other tests.
real error traceback was sometimes lost in the first "finally:" block. For
instance, testAccounting_l10n_fr_m9 was failing due to a max_allowed_packet
problem, but the error message was from ZODB Connection, because
get_transaction().commit() raised a second exception hidding the first one.

This means that if a site cannot be installed, the first test will be a
failure with the real traceback and all other tests will only get an
"Installation of this site already failed, giving up" error.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9896 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a47cbec4
......@@ -142,6 +142,10 @@ from Products.ERP5.ERP5Site import ERP5Site
portal_name = 'erp5_portal'
# we keep a reference to all sites for wich setup failed the first time, to
# prevent replaying the same failing setup step for each test.
failed_portal_installation = {}
class ERP5TypeTestCase(PortalTestCase):
def getTitle(self):
......@@ -387,6 +391,9 @@ def setupERP5Site( business_template_list=(),
business_template_list must be specified correctly
(e.g. '("erp5_common", )').
'''
if portal_name in failed_portal_installation:
raise RuntimeError, 'Installation of %s already failed, giving up'\
% portal_name
try:
if app is None:
app = ZopeTestCase.app()
......@@ -498,7 +505,10 @@ def setupERP5Site( business_template_list=(),
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time()-_start,))
ZopeTestCase._print('Ran Unit test of %s\n' % title)
finally:
except:
get_transaction().abort()
raise
else:
get_transaction().commit()
ZopeTestCase.close(app)
except:
......@@ -506,6 +516,8 @@ def setupERP5Site( business_template_list=(),
traceback.print_exc(file=f)
ZopeTestCase._print(f.getvalue())
f.close()
failed_portal_installation[portal_name] = 1
raise
def optimize():
'''Significantly reduces portal creation time.'''
......
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