Commit 0b54c5c8 authored by Hanno Schlichting's avatar Hanno Schlichting

Fixed ``testZODBCompat`` tests in ZopeTestCase to match modern ZODB semantics....

Fixed ``testZODBCompat`` tests in ZopeTestCase to match modern ZODB semantics. There is no explicit contract for the time _v attributes actually get removed. The tests in question where bogus, as they didn't test database load but a class variable not affected by the transaction machinery. There's other tests in the same module testing more abort semantics that have a proper demo storage setup.
parent 1517866f
...@@ -11,6 +11,9 @@ http://docs.zope.org/zope2/releases/. ...@@ -11,6 +11,9 @@ http://docs.zope.org/zope2/releases/.
Bugs Fixed Bugs Fixed
++++++++++ ++++++++++
- Fixed ``testZODBCompat`` tests in ZopeTestCase to match modern ZODB
semantics.
Features Added Features Added
++++++++++++++ ++++++++++++++
......
...@@ -309,50 +309,19 @@ class TestAttributesOfDirtyObjects(ZopeTestCase.ZopeTestCase): ...@@ -309,50 +309,19 @@ class TestAttributesOfDirtyObjects(ZopeTestCase.ZopeTestCase):
class TestTransactionAbort(ZopeTestCase.ZopeTestCase): class TestTransactionAbort(ZopeTestCase.ZopeTestCase):
def testTransactionAbort(self): def _getfolder(self):
self.folder.foo = 1 return getattr(self.app, folder_name, None)
self.assertTrue(hasattr(self.folder, 'foo'))
transaction.abort()
# The foo attribute is still present
self.assertTrue(hasattr(self.folder, 'foo'))
def testSavepointAbort(self):
self.folder.foo = 1
self.assertTrue(hasattr(self.folder, 'foo'))
transaction.savepoint(optimistic=True)
transaction.abort()
# This time the abort nukes the foo attribute...
self.assertFalse(hasattr(self.folder, 'foo'))
def testTransactionAbortPersistent(self):
self.folder._p_foo = 1
self.assertTrue(hasattr(self.folder, '_p_foo'))
transaction.abort()
# The _p_foo attribute is still present
self.assertTrue(hasattr(self.folder, '_p_foo'))
def testSavepointAbortPersistent(self): def testTransactionAbort(self):
self.folder._p_foo = 1 folder = self._getfolder()
self.assertTrue(hasattr(self.folder, '_p_foo')) self.assert_(folder is not None)
transaction.savepoint(optimistic=True) self.assert_(folder._p_jar is None)
transaction.abort() transaction.savepoint()
# This time the abort nukes the _p_foo attribute... self.assert_(folder._p_jar is not None)
self.assertFalse(hasattr(self.folder, '_p_foo'))
def testTransactionAbortVolatile(self):
self.folder._v_foo = 1
self.assertTrue(hasattr(self.folder, '_v_foo'))
transaction.abort()
# The _v_foo attribute is still present
self.assertTrue(hasattr(self.folder, '_v_foo'))
def testSavepointAbortVolatile(self):
self.folder._v_foo = 1
self.assertTrue(hasattr(self.folder, '_v_foo'))
transaction.savepoint(optimistic=True)
transaction.abort() transaction.abort()
# This time the abort nukes the _v_foo attribute... del folder
self.assertFalse(hasattr(self.folder, '_v_foo')) folder = self._getfolder()
self.assert_(folder is None)
def test_suite(): def test_suite():
......
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