[Erp5-report] r39726 jm - /erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Oct 31 16:07:54 CET 2010


Author: jm
Date: Sun Oct 31 16:07:54 2010
New Revision: 39726

URL: http://svn.erp5.org?rev=39726&view=rev
Log:
Add test showing that currently, it is problably unsafe to cache a bound method

Modified:
    erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py

Modified: erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py?rev=39726&r1=39725&r2=39726&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py [utf8] Sun Oct 31 16:07:54 2010
@@ -33,7 +33,7 @@ import unittest
 import transaction
 from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules
 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):
   def getBusinessTemplateList(self):
@@ -155,6 +155,23 @@ class TestPortalTypeClass(ERP5TypeTestCa
       obj.newContent('file', portal_type)
       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):
   """




More information about the Erp5-report mailing list