[Zope-Checkins] CVS: Zope/lib/python/ZODB/tests - PackableStorage.py:1.15.28.2

Toby Dickenson tdickenson@geminidataloggers.com
Wed, 14 May 2003 17:49:14 -0400


Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv3591/tests

Modified Files:
      Tag: toby_directorystorage_tests_branch
	PackableStorage.py 
Log Message:
commit objects in the right order to avoid creating a dangling reference. This change has made these two tests less readable - fix that once the tests pass to minimise merge conficts

=== Zope/lib/python/ZODB/tests/PackableStorage.py 1.15.28.1 => 1.15.28.2 ===
--- Zope/lib/python/ZODB/tests/PackableStorage.py:1.15.28.1	Wed May 14 17:18:39 2003
+++ Zope/lib/python/ZODB/tests/PackableStorage.py	Wed May 14 17:49:13 2003
@@ -266,11 +266,13 @@
         # Create a persistent object, with some initial state
         obj1 = self._newobj()
         oid1 = obj1.getoid()
+        revidn2 = self._dostoreNP(oid1, data=pickle.dumps(obj1))
         # Create another persistent object, with some initial state.  Make
         # sure it's oid is greater than the first object's oid.
         obj2 = self._newobj()
         oid2 = obj2.getoid()
         self.failUnless(oid2 > oid1)
+        revidn1 = self._dostoreNP(oid2, data=pickle.dumps(obj2))
         # Link the root object to the persistent objects, in order to keep
         # them alive.  Store the root object.
         root.obj1 = obj1
@@ -283,7 +285,7 @@
         eq(loads(data).value, 0)
         # Commit three different revisions of the first object
         obj1.value = 1
-        revid1 = self._dostoreNP(oid1, data=pickle.dumps(obj1))
+        revid1 = self._dostoreNP(oid1, revid=revidn2, data=pickle.dumps(obj1))
         obj1.value = 2
         revid2 = self._dostoreNP(oid1, revid=revid1, data=pickle.dumps(obj1))
         obj1.value = 3
@@ -303,7 +305,7 @@
         eq(pobj.value, 3)
         # Now commit a revision of the second object
         obj2.value = 11
-        revid4 = self._dostoreNP(oid2, data=pickle.dumps(obj2))
+        revid4 = self._dostoreNP(oid2, revid=revidn1, data=pickle.dumps(obj2))
         # And make sure the revision can be extracted
         data = self._storage.loadSerial(oid2, revid4)
         pobj = pickle.loads(data)