Commit 053ca4ac authored by Nicolas Dumazet's avatar Nicolas Dumazet

do not do systematic transactions to avoid extraneous resetDynamicDocuments calls


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42860 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 56edeedc
......@@ -69,7 +69,6 @@ from Testing import ZopeTestCase
from Testing.ZopeTestCase import PortalTestCase, user_name
from Products.CMFCore.utils import getToolByName
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Base import _aq_reset
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from zLOG import LOG, DEBUG
......@@ -410,7 +409,6 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
property_sheet = getattr(portal_property_sheets, property_sheet_name, None)
if property_sheet is None:
property_sheet = portal_property_sheets.newContent(id=property_sheet_name)
transaction.commit()
# We set the property sheet on the portal type
types_tool = self.getTypesTool()
......@@ -418,7 +416,6 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
property_sheet_set = set(ti.getTypePropertySheetList())
property_sheet_set.add(property_sheet_name)
ti.setTypePropertySheetList(list(property_sheet_set))
transaction.commit()
# remember that we added a property sheet for tear down
self._added_property_sheets.setdefault(
......@@ -917,7 +914,6 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
'''
portal_name = self.getPortalName()
title = self.getTitle()
from Products.ERP5Type.Base import _aq_reset
if portal_name in failed_portal_installation:
raise SetupSiteError(
'Installation of %s already failed, giving up' % portal_name)
......@@ -1017,12 +1013,10 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
setattr(app,'isIndexable', 1)
portal.portal_catalog.manage_hotReindexAll()
portal.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary()
transaction.commit()
self.tic(not quiet)
# Reset aq dynamic, so all unit tests will start again
_aq_reset()
# Log out
if not quiet:
ZopeTestCase._print('Logout ... \n')
......
......@@ -83,7 +83,8 @@ class PropertySheetTestCase(ERP5TypeTestCase):
transaction.commit()
super(PropertySheetTestCase, self).tearDown()
def _addProperty(self, portal_type_name, property_sheet_id, property_id, **kw):
def _addProperty(self, portal_type_name, property_sheet_id, property_id,
commit=True, **kw):
"""quickly add a property to a type"""
self.assertTrue('portal_type' in kw)
......@@ -94,6 +95,7 @@ class PropertySheetTestCase(ERP5TypeTestCase):
ps._delObject(property_id)
property = ps.newContent(reference=property_id, **kw)
if commit:
transaction.commit()
class TestERP5Type(PropertySheetTestCase, LogInterceptor):
......@@ -1230,6 +1232,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
setDefault[Property] are working correctly
"""
self._addProperty('Person', 'Person_lang', 'available_language',
commit=False,
**self.DEFAULT_LANGUAGE_PROP)
self._addProperty('Email', 'Email_lang', 'available_language',
**self.DEFAULT_LANGUAGE_PROP)
......@@ -1365,6 +1368,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
Check in particular that both behave the same way regarding acquisition
"""
self._addProperty('Person', 'Person_19d', 'name_included_in_address',
commit=False,
portal_type='Standard Property',
property_default="python: True",
elementary_type="boolean")
......@@ -2733,6 +2737,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
on a mono valued acquired property
"""
self._addProperty('Person', 'Person_foobar', 'foo_bar',
commit=False,
elementary_type='string',
portal_type='Standard Property')
self._addProperty('Email', 'Email_foobar', 'foo_bar',
......
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