From 15f7d8f1d3bf9cc52b3efc8f94dbf783b1210d18 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Wed, 27 May 2015 16:48:09 +0200 Subject: [PATCH] live tests: simplify the code reactivating subscription of portal_activities Even though we can have different transactions between the beginning and the end of a test, transaction.get().__hash__() might return the same value. So always resubscribe portal_activities if it was subscribed at the beginning --- product/ERP5Type/tests/ERP5TypeLiveTestCase.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/product/ERP5Type/tests/ERP5TypeLiveTestCase.py b/product/ERP5Type/tests/ERP5TypeLiveTestCase.py index a1561b7483..d3de127572 100644 --- a/product/ERP5Type/tests/ERP5TypeLiveTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeLiveTestCase.py @@ -126,13 +126,12 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin): def _close(self): '''Closes the ZODB connection.''' - revert = transaction.get().__hash__() != self.initial_transaction_hash + self.abort() self._restoreMailHost() - if revert: - if self.activity_tool_subscribed: - self.portal.portal_activities.subscribe() - self.commit() + if self.activity_tool_subscribed: + self.portal.portal_activities.subscribe() + self.commit() def _setup(self): '''Change some site properties in order to be ready for live test @@ -140,7 +139,6 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin): # Disabling portal_activities is required in order to avoid # conflict with other threads doing tic in the same time self.login() - self.initial_transaction_hash = transaction.get().__hash__() self.activity_tool_subscribed = self.getPortalObject()\ .portal_activities.isSubscribed() self.portal.portal_activities.unsubscribe() -- 2.30.9