[Zope3-checkins] CVS: Zope3/src/zodb/storage/tests - test_mapping.py:1.3 test_file.py:1.3 test_autopack.py:1.5 basic.py:1.4

Jeremy Hylton jeremy@zope.com
Fri, 24 Jan 2003 18:21:24 -0500


Update of /cvs-repository/Zope3/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv31712/zodb/storage/tests

Modified Files:
	test_mapping.py test_file.py test_autopack.py basic.py 
Log Message:
Merge new-pickle-branch to trunk.  Yee ha!


=== Zope3/src/zodb/storage/tests/test_mapping.py 1.2 => 1.3 ===
--- Zope3/src/zodb/storage/tests/test_mapping.py:1.2	Wed Dec 25 09:12:20 2002
+++ Zope3/src/zodb/storage/tests/test_mapping.py	Fri Jan 24 18:20:51 2003
@@ -27,6 +27,10 @@
     def tearDown(self):
         self._storage.close()
 
+    def checkDatabaseVersionPersistent(self):
+        # This can't possibly work
+        pass
+
 def test_suite():
     suite = unittest.makeSuite(MappingStorageTests, 'check')
     return suite


=== Zope3/src/zodb/storage/tests/test_file.py 1.2 => 1.3 ===
--- Zope3/src/zodb/storage/tests/test_file.py:1.2	Wed Dec 25 09:12:20 2002
+++ Zope3/src/zodb/storage/tests/test_file.py	Fri Jan 24 18:20:51 2003
@@ -17,12 +17,10 @@
 from zodb.ztransaction import Transaction
 from zodb import interfaces
 
-from zodb.storage.tests import base, basic, \
-     undo, version, \
-     undoversion, packable, \
-     synchronization, conflict, history, \
-     iterator, corruption, revision, persistent, \
-     mt, readonly, recovery
+from zodb.storage.tests import base, basic, conflict, corruption, history, \
+     iterator, mt, packable, persistent, readonly, recovery, revision, \
+     synchronization, undo, undoversion, version
+
 from zodb.storage.tests.base import MinPO, zodb_unpickle
 
 class FileStorageTests(
@@ -48,14 +46,34 @@
         self._storage = zodb.storage.file.FileStorage('FileStorageTests.fs',
                                                       **kwargs)
 
+    _open = open
+
     def setUp(self):
         base.removefs("FileStorageTests.fs")
         self.open(create=1)
 
     def tearDown(self):
+        self._test_read_index()
         self._storage.close()
         base.removefs("FileStorageTests.fs")
 
+    def _test_read_index(self):
+        # For each test, open a read-only copy and make sure that
+        # reading the index file results in the same storage-internal
+        # state.
+        try:
+            copy = zodb.storage.file.FileStorage('FileStorageTests.fs',
+                                                 read_only=True)
+        except:
+            from zodb.storage.fsdump import Dumper
+            Dumper("FileStorageTests.fs").dump()
+            raise
+        
+        L1 = copy._index.items()
+        L2 = self._storage._index.items()
+        L1.sort(); L2.sort()
+        self.assertEqual(L1, L2)
+
     def checkLongMetadata(self):
         s = "X" * 75000
         try:
@@ -71,10 +89,7 @@
         else:
             self.fail("expect long user field to raise error")
 
-class FileStorageRecoveryTest(
-    base.StorageTestBase,
-    recovery.RecoveryStorage,
-    ):
+class FileStorageRecoveryTest(base.StorageTestBase, recovery.RecoveryStorage):
 
     def setUp(self):
         base.removefs("Source.fs")


=== Zope3/src/zodb/storage/tests/test_autopack.py 1.4 => 1.5 ===
--- Zope3/src/zodb/storage/tests/test_autopack.py:1.4	Wed Jan 22 16:39:24 2003
+++ Zope3/src/zodb/storage/tests/test_autopack.py	Fri Jan 24 18:20:51 2003
@@ -58,14 +58,6 @@
         while packtime == storage._autopacker._nextcheck:
             time.sleep(1)
 
-    def _mk_dbhome(self, dir):
-        # Create the storage
-        os.mkdir(dir)
-        try:
-            return self.ConcreteStorage(dir, config=self._config())
-        except:
-            self._zap_dbhome(dir)
-            raise
 
 
 


=== Zope3/src/zodb/storage/tests/basic.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/basic.py:1.3	Wed Jan 22 14:47:02 2003
+++ Zope3/src/zodb/storage/tests/basic.py	Fri Jan 24 18:20:51 2003
@@ -33,6 +33,18 @@
 
 
 class BasicStorage:
+    def checkDatabaseVersion(self):
+        version = "abcd"
+        self._storage.setVersion(version)
+        self.assertEqual(version, self._storage.getVersion())
+
+    def checkDatabaseVersionPersistent(self):
+        version = "abcd"
+        self._storage.setVersion(version)
+        self._storage.close()
+        self._open()
+        self.assertEqual(version, self._storage.getVersion())
+
     def checkBasics(self):
         t = Transaction()
         self._storage.tpc_begin(t)