Commit 59714525 authored by Julien Muchembled's avatar Julien Muchembled

testDynamicClassGeneration: fix testConstraintAfterClosingZODBConnection on Zope 2.13

parent 331625e2
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
import gc import gc
import unittest import unittest
import transaction
from persistent import Persistent from persistent import Persistent
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
...@@ -1062,7 +1063,8 @@ class TestZodbPropertySheet(ERP5TypeTestCase): ...@@ -1062,7 +1063,8 @@ class TestZodbPropertySheet(ERP5TypeTestCase):
""" """
# Open new connection and add a new constraint. # Open new connection and add a new constraint.
db = self.app._p_jar.db() db = self.app._p_jar.db()
con = db.open() tm = transaction.TransactionManager()
con = db.open(transaction_manager=tm)
app = con.root()['Application'].__of__(self.app.aq_parent) app = con.root()['Application'].__of__(self.app.aq_parent)
portal = app[self.getPortalName()] portal = app[self.getPortalName()]
from Products.ERP5.ERP5Site import getSite, setSite from Products.ERP5.ERP5Site import getSite, setSite
...@@ -1077,15 +1079,14 @@ class TestZodbPropertySheet(ERP5TypeTestCase): ...@@ -1077,15 +1079,14 @@ class TestZodbPropertySheet(ERP5TypeTestCase):
expression='python: object.getTitle() == "my_tales_constraint_title"') expression='python: object.getTitle() == "my_tales_constraint_title"')
dummy.Predicate_view() dummy.Predicate_view()
self.commit() tm.commit()
# Recreate class with a newly added constraint # Recreate class with a newly added constraint
synchronizeDynamicModules(portal, force=True) synchronizeDynamicModules(portal, force=True)
# Load test_module # Load test_module
test_module = getattr(portal, 'Test Migration') getattr(portal, 'Test Migration').objectValues()
test_module.objectValues()
# Then close this new connection. # Then close this new connection.
self.abort() tm.abort()
con.close() con.close()
# This code depends on ZODB implementation. # This code depends on ZODB implementation.
for i in db.pool.available[:]: for i in db.pool.available[:]:
......
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