Commit 1fa3d948 authored by Julien Muchembled's avatar Julien Muchembled

Revert [28054] and unregister current node at the end of the unit test.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28056 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 34c0a45f
...@@ -686,20 +686,15 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -686,20 +686,15 @@ class ERP5TypeTestCase(PortalTestCase):
# Release locks # Release locks
transaction.commit() transaction.commit()
self.portal = portal self.portal = portal
portal_activities = getattr(portal, 'portal_activities', None)
if len(setup_done) == 1: # make sure it is run only once if len(setup_done) == 1: # make sure it is run only once
try: try:
from Products import DeadlockDebugger from Products import DeadlockDebugger
except ImportError: except ImportError:
pass pass
if int(os.environ.get('start_zserver', 0)): from Testing.ZopeTestCase.utils import startZServer
from Testing.ZopeTestCase.utils import startZServer ZopeTestCase._print('Running ZServer on port %i\n'
ZopeTestCase._print('Running ZServer on port %i\n' % startZServer()[1])
% startZServer()[1])
if portal_activities is not None:
portal_activities.distributingNode = portal_activities.getCurrentNode()
portal_activities._nodes = portal_activities.distributingNode,
self._updateConnectionStrings() self._updateConnectionStrings()
self._recreateCatalog() self._recreateCatalog()
...@@ -760,6 +755,7 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -760,6 +755,7 @@ class ERP5TypeTestCase(PortalTestCase):
transaction.commit() transaction.commit()
portal_activities = getattr(portal, 'portal_activities', None)
if portal_activities is not None: if portal_activities is not None:
if not quiet: if not quiet:
ZopeTestCase._print('Executing pending activities ... ') ZopeTestCase._print('Executing pending activities ... ')
...@@ -767,9 +763,7 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -767,9 +763,7 @@ class ERP5TypeTestCase(PortalTestCase):
count = 1000 count = 1000
message_count = len(portal_activities.getMessageList()) message_count = len(portal_activities.getMessageList())
while message_count > 0: while message_count > 0:
portal_activities.distribute() portal_activities.process_timer(None, None)
portal_activities.tic()
transaction.commit()
new_message_count = len(portal_activities.getMessageList()) new_message_count = len(portal_activities.getMessageList())
if new_message_count != message_count: if new_message_count != message_count:
if not quiet: if not quiet:
...@@ -811,6 +805,19 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -811,6 +805,19 @@ class ERP5TypeTestCase(PortalTestCase):
% title) # run_unit_test depends on this string. % title) # run_unit_test depends on this string.
raise raise
def beforeClose(self):
PortalTestCase.beforeClose(self)
try:
# portal_activities.process_timer automatically registers current node
# (localhost:<random_port>). We must unregister it so that Data.fs can
# be reused without reconfiguring portal_activities.
portal_activities = self.portal.portal_activities
del portal_activities.distributingNode
del portal_activities._nodes
transaction.commit()
except AttributeError:
pass
def stepPdb(self, sequence=None, sequence_list=None): def stepPdb(self, sequence=None, sequence_list=None):
"""Invoke debugger""" """Invoke debugger"""
try: # try ipython if available try: # try ipython if available
...@@ -989,7 +996,7 @@ def dummy_tearDown(self): ...@@ -989,7 +996,7 @@ def dummy_tearDown(self):
the original tests, which would write to the FileStorage when --save the original tests, which would write to the FileStorage when --save
is enabled is enabled
''' '''
self._close() self._clear(1)
def optimize(): def optimize():
'''Significantly reduces portal creation time.''' '''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