Commit 88ff7335 authored by Sebastien Robin's avatar Sebastien Robin

disable portal_activities when the live test in running in

order to avoid having several parallel transaction working
on same activities

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42532 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 02a4eff5
...@@ -105,10 +105,14 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin): ...@@ -105,10 +105,14 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
transaction.abort() transaction.abort()
def _setup(self): def _setup(self):
'''Configures the portal. Framework authors may '''Change some site properties in order to be ready for live test
override.
''' '''
pass # Do nothing in a live test # Disabling portal_activities is required in order to avoid
# conflict with other threads doing tic in the same time
self.initial_transaction_hash = transaction.get().__hash__()
self.activity_tool_subscribed = self.getPortalObject()\
.portal_activities.isSubscribed()
self.portal.portal_activities.unsubscribe()
def setUp(self): def setUp(self):
'''Sets up the fixture. Do not override, '''Sets up the fixture. Do not override,
...@@ -137,8 +141,9 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin): ...@@ -137,8 +141,9 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
pass pass
def beforeSetUp(self): def beforeSetUp(self):
'''Called after setUp() has completed. This is '''Called before the ZODB connection is opened,
far and away the most useful hook. at the start of setUp(). By default begins
a new transaction.
''' '''
pass pass
...@@ -157,8 +162,12 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin): ...@@ -157,8 +162,12 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
def beforeClose(self): def beforeClose(self):
""" """
Clear "my activities"... how to do this ? put back site properties that were disabled for unit test
""" """
if transaction.get().__hash__() != self.initial_transaction_hash:
if self.activity_tool_subscribed:
self.portal.portal_activities.subscribe()
transaction.commit()
PortalTestCase.beforeClose(self) PortalTestCase.beforeClose(self)
def runLiveTest(test_list, verbosity=1, stream=None, **kw): def runLiveTest(test_list, verbosity=1, stream=None, **kw):
......
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