[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/tests/blob_consume.txt Unwritten blobs now can be read and have no data,

Jim Fulton jim at zope.com
Wed Jun 6 12:25:18 EDT 2007


Log message for revision 76437:
  Unwritten blobs now can be read and have no data,
  
  Hack os.rename rather than the blob to avoid a testing artifact in the
  blob implementation.
  

Changed:
  U   ZODB/trunk/src/ZODB/tests/blob_consume.txt

-=-
Modified: ZODB/trunk/src/ZODB/tests/blob_consume.txt
===================================================================
--- ZODB/trunk/src/ZODB/tests/blob_consume.txt	2007-06-06 16:25:12 UTC (rev 76436)
+++ ZODB/trunk/src/ZODB/tests/blob_consume.txt	2007-06-06 16:25:17 UTC (rev 76437)
@@ -69,24 +69,20 @@
 
     >>> open('to_import', 'wb').write('Some data.')
 
-    >>> def failing_link(self, filename):
+    >>> def failing_rename(self, filename):
     ...   raise Exception("I can't link.")
 
     >>> blob = Blob()
-    >>> blob.open('r')
-    Traceback (most recent call last):
-    BlobError: Blob does not exist.
-
-    >>> blob._os_link = failing_link
+    >>> os_rename = os.rename
+    >>> os.rename = failing_rename
     >>> blob.consumeFile('to_import')
     Traceback (most recent call last):
     Exception: I can't link.
 
-The blob did not exist before, so it shouldn't exist now::
+The blob did not have data before, so it shouldn't have data now::
 
-    >>> blob.open('r')
-    Traceback (most recent call last):
-    BlobError: Blob does not exist.
+    >>> blob.open('r').read()
+    ''
 
 Case 2: We thave uncommitted data, but the link operation fails. The
 exception will be re-raised and the target file will exist with the previous
@@ -97,7 +93,6 @@
     >>> blob_writing.write('Uncommitted data')
     >>> blob_writing.close()
 
-    >>> blob._os_link = failing_link
     >>> blob.consumeFile('to_import')
     Traceback (most recent call last):
     Exception: I can't link.
@@ -107,3 +102,5 @@
 
     >>> blob.open('r').read()
     'Uncommitted data'
+
+    >>> os.rename = os_rename



More information about the Zodb-checkins mailing list