[Zodb-checkins] CVS: ZODB4/src/zodb/storage/tests - test_zodb_simple.py:1.3

Barry Warsaw barry@wooz.org
Wed, 22 Jan 2003 15:58:34 -0500


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

Modified Files:
	test_zodb_simple.py 
Log Message:
Cleanups and forward ports from ZODB 3.2, such as:

check the berkeley_is_available flag before attempting to run the BDB
storage tests.


=== ZODB4/src/zodb/storage/tests/test_zodb_simple.py 1.2 => 1.3 ===
--- ZODB4/src/zodb/storage/tests/test_zodb_simple.py:1.2	Wed Dec 25 09:12:20 2002
+++ ZODB4/src/zodb/storage/tests/test_zodb_simple.py	Wed Jan 22 15:58:31 2003
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -12,25 +12,19 @@
 #
 ##############################################################################
 
-try:
-    import bsddb3
-except ImportError:
-    raise RuntimeError, 'BerkeleyDB not available'
-
 # Test some simple ZODB level stuff common to both the Minimal and Full
 # storages, like transaction aborts and commits, changing objects, etc.
 # Doesn't test undo, versions, or packing.
 
 import time
 import unittest
-# Import this here and now so that import failures properly cause the test
-# suite to ignore these tests.
-import bsddb3
 
-from zodb.storage.tests.base import ZODBTestBase
 from transaction import get_transaction
 from persistence.dict import PersistentDict
 
+from zodb.storage.base import berkeley_is_available
+from zodb.storage.tests.base import ZODBTestBase
+
 
 
 class CommitAndRead:
@@ -87,8 +81,9 @@
 
 def test_suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(MinimalCommitAndRead, 'check'))
-    suite.addTest(unittest.makeSuite(FullCommitAndRead, 'check'))
+    if berkeley_is_available:
+        suite.addTest(unittest.makeSuite(MinimalCommitAndRead, 'check'))
+        suite.addTest(unittest.makeSuite(FullCommitAndRead, 'check'))
     return suite