Commit d931c6f6 authored by Sebastien Robin's avatar Sebastien Robin

unit test: Enable again calls to setUpOnce when for portal components tests

parent e1ce3bed
......@@ -731,6 +731,16 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
return sorted([ str(message.getMessage())
for message in obj.checkConsistency() ])
def _callSetUpOnce(self):
setup_once = getattr(self, 'setUpOnce', None)
if setup_once is not None and \
not getattr(self.portal, 'set_up_once_called', 0):
self.portal.set_up_once_called = 1
ZopeTestCase._print('Executing setUpOnce ... ')
start = time.time()
setup_once()
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start))
class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
def getPortalName(self):
......@@ -1073,16 +1083,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
'Assignor', 'Author', 'Auditor', 'Associate'], [])
user = uf.getUserById('ERP5TypeTestCase').__of__(uf)
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()
setup_once()
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start))
self._callSetUpOnce()
# Enable reindexing
# Do hot reindexing # Does not work
......
......@@ -304,10 +304,16 @@ class ERP5TypeTestLoader(unittest.TestLoader):
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeLiveTestCase import ERP5TypeLiveTestCase
class ComponentTestCase(ERP5TypeLiveTestCase):
def setUp(self):
super(ComponentTestCase, self).setUp()
self._callSetUpOnce()
# Bootstrap has been done in loadTestsFromNames, so the test can now
# be loaded like any Live Test on a real instance
if ERP5TypeLiveTestCase not in ERP5TypeTestCase.__bases__:
ERP5TypeTestCase.__bases__ = ERP5TypeLiveTestCase,
if ComponentTestCase not in ERP5TypeTestCase.__bases__:
ERP5TypeTestCase.__bases__ = ComponentTestCase,
# TestLoader() does not perform any import so import the Module manually
module = __import__('erp5.component.test',
......
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