[Zope-Checkins] CVS: ZODB3/ZEO/tests - testZEO.py:1.54.2.9.4.1 testConnection.py:1.1.2.6.4.1

Jeremy Hylton jeremy at zope.com
Thu Sep 11 12:55:27 EDT 2003


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

Modified Files:
      Tag: Zope-2_6-branch
	testZEO.py testConnection.py 
Log Message:
Make these tests work even if BDBStorage isn't available.

When run with the Zope 2.6 test suite, we've got ZEO but not
BDBStorage.


=== ZODB3/ZEO/tests/testZEO.py 1.54.2.9 => 1.54.2.9.4.1 ===
--- ZODB3/ZEO/tests/testZEO.py:1.54.2.9	Tue Aug  5 13:29:06 2003
+++ ZODB3/ZEO/tests/testZEO.py	Thu Sep 11 11:55:26 2003
@@ -180,23 +180,28 @@
     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, config=config)
-    elif storage == 'minimal':
-        return BDBMinimalStorage(path, config=config)
-    else:
-        assert 0, storage
+try:
+    import BDBStorage
+except ImportError:
+    BDBStorage = None
+else:
+    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, config=config)
+        elif storage == 'minimal':
+            return BDBMinimalStorage(path, config=config)
+        else:
+            assert 0, storage
 
 class WindowsTests(GenericTests):
 
@@ -265,15 +270,10 @@
 else:
     raise RuntimeError, "unsupported os: %s" % os.name
 
-import BDBStorage
-if BDBStorage.is_available:
+if BDBStorage is not None and BDBStorage.is_available:
     test_classes.append(BDBTests)
 
 def test_suite():
-    # shutup warnings about mktemp
-    import warnings
-    warnings.filterwarnings("ignore", "mktemp")
-
     suite = unittest.TestSuite()
     for klass in test_classes:
         sub = unittest.makeSuite(klass, 'check')


=== ZODB3/ZEO/tests/testConnection.py 1.1.2.6 => 1.1.2.6.4.1 ===
--- ZODB3/ZEO/tests/testConnection.py:1.1.2.6	Thu Aug  7 12:29:20 2003
+++ ZODB3/ZEO/tests/testConnection.py	Thu Sep 11 11:55:26 2003
@@ -129,17 +129,14 @@
 else:
     raise RuntimeError, "unsupported os: %s" % os.name
 
-import BDBStorage
-if BDBStorage.is_available:
-    test_classes.append(BDBConnectionTests)
-
+try:
+    import BDBStorage
+    if BDBStorage.is_available:
+        test_classes.append(BDBConnectionTests)
+except ImportError:
+    pass
 
 def test_suite():
-
-    # shutup warnings about mktemp
-    import warnings
-    warnings.filterwarnings("ignore", "mktemp")
-
     suite = unittest.TestSuite()
     for klass in test_classes:
         sub = unittest.makeSuite(klass, 'check')




More information about the Zope-Checkins mailing list