[Zodb-checkins] CVS: ZODB3/ZEO/tests - testZEO.py:1.54.2.6

Barry Warsaw barry at zope.com
Mon Jul 28 14:47:43 EDT 2003


Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv17916/ZEO/tests

Modified Files:
      Tag: ZODB3-3_1-branch
	testZEO.py 
Log Message:
BDBFactory: Make sure we can pass in the readonly flag.  Also merge in
with the Windows tests, retaining the necessary forward-compatible
naming (Tim should verify).


=== ZODB3/ZEO/tests/testZEO.py 1.54.2.5 => 1.54.2.6 ===
--- ZODB3/ZEO/tests/testZEO.py:1.54.2.5	Fri Jul 25 18:12:35 2003
+++ ZODB3/ZEO/tests/testZEO.py	Mon Jul 28 13:47:35 2003
@@ -170,14 +170,26 @@
         removefs(self.__fs_base)
 
 
-def BDBFactory(path, storage):
+# Forward-compatible naming
+class FileStorageTests(UnixTests):
+    pass
+
+
+def BDBFactory(path, create=None, readonly=None, storage='full'):
+    from BDBStorage.BerkeleyBase import BerkeleyConfig
     from BDBStorage.BDBFullStorage import BDBFullStorage
     from BDBStorage.BDBMinimalStorage import BDBMinimalStorage
 
+    if readonly:
+        config = BerkeleyConfig()
+        config.read_only = readonly
+    else:
+        config = None
+
     if storage == 'full':
-        return BDBFullStorage(path)
+        return BDBFullStorage(path, config=config)
     elif storage == 'minimal':
-        return BDBMinimalStorage(path)
+        return BDBMinimalStorage(path, config=config)
     else:
         assert 0, storage
 
@@ -223,14 +235,15 @@
 class BDBTests(os.name == "nt" and WindowsTests or UnixTests):
     def getStorage(self):
         self.__bdbdir = tempfile.mktemp()
-        return 'ZEO.tests.testZEO.BDBFactory', (self.__bdbdir, 'full')
+        return 'ZEO.tests.testZEO.BDBFactory', (
+            self.__bdbdir, None, None, 'full')
 
     def delStorage(self):
         shutil.rmtree(self.__bdbdir)
 
 
 if os.name == "posix":
-    test_classes = [UnixTests]
+    test_classes = [FileStorageTests]
 elif os.name == "nt":
     test_classes = [WindowsTests]
 else:




More information about the Zodb-checkins mailing list