Log message for revision 117146:
  Backported c116931 from trunk
  

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/Testing/ZopeTestCase/testZODBCompat.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst  2010-10-01 22:12:10 UTC (rev 117145)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-10-01 22:20:20 UTC (rev 117146)
@@ -11,6 +11,9 @@
 Bugs Fixed
 ++++++++++
 
+- Fixed ``testZODBCompat`` tests in ZopeTestCase to match modern ZODB
+  semantics.
+
 - Fixed unit test that failed on fast Windows machines.
 
 - Fixed OverflowError in Products.ZCatalog.Lazy on 64bit python

Modified: Zope/branches/2.12/src/Testing/ZopeTestCase/testZODBCompat.py
===================================================================
--- Zope/branches/2.12/src/Testing/ZopeTestCase/testZODBCompat.py       
2010-10-01 22:12:10 UTC (rev 117145)
+++ Zope/branches/2.12/src/Testing/ZopeTestCase/testZODBCompat.py       
2010-10-01 22:20:20 UTC (rev 117146)
@@ -322,52 +322,21 @@
 
 class TestTransactionAbort(ZopeTestCase.ZopeTestCase):
 
+    def _getfolder(self):
+        return getattr(self.app, folder_name, None)
+
     def testTransactionAbort(self):
-        self.folder.foo = 1
-        self.failUnless(hasattr(self.folder, 'foo'))
+        folder = self._getfolder()
+        self.assert_(folder is not None)
+        self.assert_(folder._p_jar is None)
+        transaction.savepoint()
+        self.assert_(folder._p_jar is not None)
         transaction.abort()
-        # The foo attribute is still present
-        self.failUnless(hasattr(self.folder, 'foo'))
+        del folder
+        folder = self._getfolder()
+        self.assert_(folder is None)
 
-    def testSubTransactionAbort(self):
-        self.folder.foo = 1
-        self.failUnless(hasattr(self.folder, 'foo'))
-        transaction.savepoint(optimistic=True)
-        transaction.abort()
-        # This time the abort nukes the foo attribute...
-        self.failIf(hasattr(self.folder, 'foo'))
 
-    def testTransactionAbortPersistent(self):
-        self.folder._p_foo = 1
-        self.failUnless(hasattr(self.folder, '_p_foo'))
-        transaction.abort()
-        # The _p_foo attribute is still present
-        self.failUnless(hasattr(self.folder, '_p_foo'))
-
-    def testSubTransactionAbortPersistent(self):
-        self.folder._p_foo = 1
-        self.failUnless(hasattr(self.folder, '_p_foo'))
-        transaction.savepoint(optimistic=True)
-        transaction.abort()
-        # This time the abort nukes the _p_foo attribute...
-        self.failIf(hasattr(self.folder, '_p_foo'))
-
-    def testTransactionAbortVolatile(self):
-        self.folder._v_foo = 1
-        self.failUnless(hasattr(self.folder, '_v_foo'))
-        transaction.abort()
-        # The _v_foo attribute is still present
-        self.failUnless(hasattr(self.folder, '_v_foo'))
-
-    def testSubTransactionAbortVolatile(self):
-        self.folder._v_foo = 1
-        self.failUnless(hasattr(self.folder, '_v_foo'))
-        transaction.savepoint(optimistic=True)
-        transaction.abort()
-        # This time the abort nukes the _v_foo attribute...
-        self.failIf(hasattr(self.folder, '_v_foo'))
-
-
 def test_suite():
     from unittest import TestSuite, makeSuite
     suite = TestSuite()

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to