Commit e6f4e312 authored by Julien Muchembled's avatar Julien Muchembled

testDynamicClassGeneration: clean up objects created by testERP5Broken

This was breaking the next test.
parent 56af85cf
...@@ -2251,21 +2251,27 @@ class Test(ERP5TypeTestCase): ...@@ -2251,21 +2251,27 @@ class Test(ERP5TypeTestCase):
# Create a broken ghost object # Create a broken ghost object
import erp5.portal_type import erp5.portal_type
name = self._testMethodName name = self._testMethodName
ptype = self.portal.portal_types.newContent(name, type_class="File") types_tool = self.portal.portal_types
ptype = types_tool.newContent(name, type_class="File")
file = ptype.constructInstance(self.portal, name, data="foo") file = ptype.constructInstance(self.portal, name, data="foo")
self.assertEqual(file.size, 3) self.assertEqual(file.size, 3)
self.commit() self.commit()
self.portal._p_jar.cacheMinimize() try:
del file self.portal._p_jar.cacheMinimize()
delattr(erp5.portal_type, name) del file
ptype.setTypeClass(name) delattr(erp5.portal_type, name)
self.commit() ptype.setTypeClass(name)
file = self.portal.__dict__[name] self.commit()
self.assertTrue(isinstance(file, InitGhostBase)) file = self.portal.__dict__[name]
# Check that the class is unghosted before resolving __setattr__ self.assertTrue(isinstance(file, InitGhostBase))
self.assertRaises(BrokenModified, setattr, file, "size", 0) # Check that the class is unghosted before resolving __setattr__
self.assertTrue(isinstance(file, ERP5BaseBroken)) self.assertRaises(BrokenModified, setattr, file, "size", 0)
self.assertEqual(file.size, 3) self.assertTrue(isinstance(file, ERP5BaseBroken))
self.assertEqual(file.size, 3)
finally:
self.portal._delObject(name)
types_tool._delObject(name)
self.commit()
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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