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):
# Release locks
transaction.commit()
self.portal = portal
portal_activities = getattr(portal, 'portal_activities', None)
if len(setup_done) == 1: # make sure it is run only once
try:
from Products import DeadlockDebugger
except ImportError:
pass
if int(os.environ.get('start_zserver', 0)):
from Testing.ZopeTestCase.utils import startZServer
ZopeTestCase._print('Running ZServer on port %i\n'
% startZServer()[1])
if portal_activities is not None:
portal_activities.distributingNode = portal_activities.getCurrentNode()
portal_activities._nodes = portal_activities.distributingNode,
self._updateConnectionStrings()
self._recreateCatalog()
......@@ -760,6 +755,7 @@ class ERP5TypeTestCase(PortalTestCase):
transaction.commit()
portal_activities = getattr(portal, 'portal_activities', None)
if portal_activities is not None:
if not quiet:
ZopeTestCase._print('Executing pending activities ... ')
......@@ -767,9 +763,7 @@ class ERP5TypeTestCase(PortalTestCase):
count = 1000
message_count = len(portal_activities.getMessageList())
while message_count > 0:
portal_activities.distribute()
portal_activities.tic()
transaction.commit()
portal_activities.process_timer(None, None)
new_message_count = len(portal_activities.getMessageList())
if new_message_count != message_count:
if not quiet:
......@@ -811,6 +805,19 @@ class ERP5TypeTestCase(PortalTestCase):
% title) # run_unit_test depends on this string.
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):
"""Invoke debugger"""
try: # try ipython if available
......@@ -989,7 +996,7 @@ def dummy_tearDown(self):
the original tests, which would write to the FileStorage when --save
is enabled
'''
self._close()
self._clear(1)
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