Commit f5d65e95 authored by Julien Muchembled's avatar Julien Muchembled

Add test showing that currently, it is problably unsafe to cache a bound method

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39726 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1abc224b
...@@ -33,7 +33,7 @@ import unittest ...@@ -33,7 +33,7 @@ import unittest
import transaction import transaction
from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import skip from Products.ERP5Type.tests.backportUnittest import expectedFailure, skip
class TestPortalTypeClass(ERP5TypeTestCase): class TestPortalTypeClass(ERP5TypeTestCase):
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
...@@ -155,6 +155,23 @@ class TestPortalTypeClass(ERP5TypeTestCase): ...@@ -155,6 +155,23 @@ class TestPortalTypeClass(ERP5TypeTestCase):
obj.newContent('file', portal_type) obj.newContent('file', portal_type)
obj.file.aq_base obj.file.aq_base
@expectedFailure
def testBoundMethodCaching(self):
"""Test that it is safe to cache a bound method during a transaction
This test currently fails with the following exception:
TypeError: unbound method newContent() must be called with FolderMixIn
instance as first argument (got Folder instance instead)
What is the scope of this failure ? Is this test a realistic use case ?
Is there anyway to reset dynamic classes without triggering this error ?
Or do we need to reset the fewest classes as possible ?
"""
newDocument = self.portal.newContent(self.id(), 'Folder').newContent
self.portal.portal_type.newContent(portal_type='Base Type',
type_class='Folder')
newDocument(portal_type='Folder')
class TestZodbPropertySheet(ERP5TypeTestCase): class TestZodbPropertySheet(ERP5TypeTestCase):
""" """
......
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