Commit dba0b9ac authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support setUpOnce() method that is only called once par setting up ERP5 site....

support setUpOnce() method that is only called once par setting up ERP5 site. its result will be saved with --save.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19499 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 785e7292
...@@ -351,10 +351,8 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -351,10 +351,8 @@ class ERP5TypeTestCase(PortalTestCase):
light_install = self.enableLightInstall() light_install = self.enableLightInstall()
create_activities = self.enableActivityTool() create_activities = self.enableActivityTool()
hot_reindexing = self.enableHotReindexing() hot_reindexing = self.enableHotReindexing()
setupERP5Site(business_template_list=new_template_list, self.setUpERP5Site(business_template_list=new_template_list,
light_install=light_install, light_install=light_install,
portal_name=self.getPortalName(),
title=self.getTitle(),
create_activities=create_activities, create_activities=create_activities,
quiet=install_bt5_quiet, quiet=install_bt5_quiet,
hot_reindexing=hot_reindexing, hot_reindexing=hot_reindexing,
...@@ -557,10 +555,9 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -557,10 +555,9 @@ class ERP5TypeTestCase(PortalTestCase):
self.assertEqual(object.getSimulationState(), reference_workflow_state) self.assertEqual(object.getSimulationState(), reference_workflow_state)
return workflow_error_message return workflow_error_message
def setupERP5Site( business_template_list=(), def setUpERP5Site(self,
business_template_list=(),
app=None, app=None,
portal_name=portal_name,
title='',
quiet=0, quiet=0,
light_install=1, light_install=1,
create_activities=1, create_activities=1,
...@@ -571,6 +568,8 @@ def setupERP5Site( business_template_list=(), ...@@ -571,6 +568,8 @@ def setupERP5Site( business_template_list=(),
business_template_list must be specified correctly business_template_list must be specified correctly
(e.g. '("erp5_base", )'). (e.g. '("erp5_base", )').
''' '''
portal_name = self.getPortalName()
title = self.getTitle()
from Products.ERP5Type.Base import _aq_reset from Products.ERP5Type.Base import _aq_reset
if portal_name in failed_portal_installation: if portal_name in failed_portal_installation:
raise RuntimeError, 'Installation of %s already failed, giving up'\ raise RuntimeError, 'Installation of %s already failed, giving up'\
...@@ -677,6 +676,20 @@ def setupERP5Site( business_template_list=(), ...@@ -677,6 +676,20 @@ def setupERP5Site( business_template_list=(),
if not quiet: if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start)) ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start))
setup_once = getattr(self, 'setUpOnce', None)
if setup_once is not None and \
not getattr(portal, 'set_up_once_called', 0):
portal.set_up_once_called = 1
if not quiet:
ZopeTestCase._print('Executing setUpOnce ... ')
start = time.time()
# setUpOnce method may use self.app and self.portal
self.app = app
self.portal = portal
setup_once()
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start))
# Enable reindexing # Enable reindexing
# Do hot reindexing # Does not work # Do hot reindexing # Does not work
if hot_reindexing: if hot_reindexing:
......
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