[Zodb-checkins] SVN: ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/ Fix transaction conflict error test and tweak TODO.

Chris McDonough chrism at plope.com
Wed Jun 15 01:16:47 EDT 2005


Log message for revision 30805:
  Fix transaction conflict error test and tweak TODO.
  

Changed:
  U   ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/TODO.txt
  U   ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/tests/transaction.txt

-=-
Modified: ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/TODO.txt
===================================================================
--- ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/TODO.txt	2005-06-15 04:10:00 UTC (rev 30804)
+++ ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/TODO.txt	2005-06-15 05:16:47 UTC (rev 30805)
@@ -7,8 +7,6 @@
 
 - Test BlobStorage.getSize
 
-- Test import/export.
-
 - Test conflict behavior.
 
 - Test shared client usage of blob cache dir.

Modified: ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/tests/transaction.txt
===================================================================
--- ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/tests/transaction.txt	2005-06-15 04:10:00 UTC (rev 30804)
+++ ZODB/branches/ctheune-blobsupport/src/ZODB/Blobs/tests/transaction.txt	2005-06-15 05:16:47 UTC (rev 30805)
@@ -134,27 +134,36 @@
         ...
     TypeError: coercing to Unicode: need string or buffer, BlobFile found
 
+Abort for good measure:
+
+    >>> transaction.abort()
+
 Attempting to change a blob simultaneously from two different
 connections should result in a write conflict error (this test is
 broken currently because I need to figure out how to commit the
 changes made in each connection independently):
 
-    >>> transaction.abort()
-    >>> blob1c1 = root1['blob1']
-    >>> blob1c2 = root2['blob1']
-    >>> blob1c1fh1 = blob1c1.open('a')
-    >>> blob1c2fh1 = blob1c2.open('a')
-    >>> blob1c1fh1.write('this is from connection 1')
-    >>> blob1c2fh1.write('this is from connection 2')
-    >>> transaction.commit()
+    >>> tm1 = transaction.TransactionManager()
+    >>> tm2 = transaction.TransactionManager()
+    >>> root3 = database.open(txn_mgr=tm1).root()
+    >>> root4 = database.open(txn_mgr=tm2).root()
+    >>> blob1c3 = root3['blob1']
+    >>> blob1c4 = root4['blob1']
+    >>> blob1c3fh1 = blob1c3.open('a')
+    >>> blob1c4fh1 = blob1c4.open('a')
+    >>> blob1c3fh1.write('this is from connection 3')
+    >>> blob1c4fh1.write('this is from connection 4')
+    >>> tm1.get().commit()
+    >>> tm2.get().commit()
     Traceback (most recent call last):
         ...
-    ConflictError
+    ConflictError: database conflict error (oid 0x01, class ZODB.Blobs.Blob.Blob)
 
 While we are testing this, we don't need the storage directory and databases
 anymore:
 
     >>> import shutil
     >>> shutil.rmtree(blob_dir)
-    >>> transaction.abort()
+    >>> tm1.get().abort()
+    >>> tm2.get().abort()
     >>> database.close()



More information about the Zodb-checkins mailing list