Commit 132c2685 authored by Bryton Lacquement's avatar Bryton Lacquement :door:

testDynamicClassGeneration: fix the __setstate__ test

This commit changes the way we obtain the original
Products.ERP5Type.Base.Base.__setstate__ method (before it is
monkey-patched (1)).

Previously, Products.ERP5Type.Base.Base.__setstate__ was inherited from
persistent.Persistent.

Since the previous commit, Products.ERP5Type.Base.Base overrides it with
its own method.

So the test was no longer looking at the right thing.

---
(1): See the code inside product/ERP5Type/dynamic/lazy_class.py and
product/ERP5Type/dynamic/persistent_migration.py
parent a0e79027
......@@ -38,11 +38,11 @@ import warnings
import sys
import transaction
from persistent import Persistent
from ZODB.broken import BrokenModified
from zExceptions import Forbidden, NotFound
from AccessControl.SecurityManagement import \
getSecurityManager, setSecurityManager, noSecurityManager
from Products.ERP5Type.dynamic.persistent_migration import Base__setstate__
from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules
from Products.ERP5Type.dynamic.lazy_class import ERP5BaseBroken, InitGhostBase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -78,7 +78,7 @@ class TestPortalTypeClass(ERP5TypeTestCase):
self.assertEqual(klass.__module__,
migrated and 'erp5.portal_type' or 'erp5.component.document.erp5_version.Person')
self.assertEqual(klass.__name__, 'Person')
self.assertEqual(klass.__setstate__ is Persistent.__setstate__, migrated)
self.assertEqual(klass.__setstate__.im_func is Base__setstate__.im_func, migrated)
# Import a .xml containing a Person created with the full module name
self.importObjectFromFile(person_module, 'non_migrated_person.xml')
......
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