Drop left-over activities between tests

On Zope 2.12, in test files with multiple test classes, activities from one test class are reactivated on the next test class.

This doesn't happen on Zope 2.8 by pure accident: during portal construction, the skin is not properly configured, and so
activities are not reactivated as they are on Zope 2.12.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31320 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 22126c7b
...@@ -973,10 +973,16 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase): ...@@ -973,10 +973,16 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
def beforeClose(self): def beforeClose(self):
PortalTestCase.beforeClose(self) PortalTestCase.beforeClose(self)
try: try:
portal_activities = self.portal.portal_activities
# Drop remaining activities.
count = portal_activities.countMessage()
portal_activities.manageClearActivities()
if count:
LOG('Products.ERP5Type.tests.ERP5TypeTestCase.beforeClose', DEBUG,
'dropped %d left-over activity messages' % (count,))
# portal_activities.process_timer automatically registers current node # portal_activities.process_timer automatically registers current node
# (localhost:<random_port>). We must unregister it so that Data.fs can # (localhost:<random_port>). We must unregister it so that Data.fs can
# be reused without reconfiguring portal_activities. # be reused without reconfiguring portal_activities.
portal_activities = self.portal.portal_activities
del portal_activities.distributingNode del portal_activities.distributingNode
del portal_activities._nodes del portal_activities._nodes
transaction.commit() transaction.commit()
......
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