[Zope3-checkins] CVS: ZODB4/src/zodb/storage/tests - test_virgin.py:1.3

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


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

Modified Files:
	test_virgin.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_virgin.py 1.2 => 1.3 ===
--- ZODB4/src/zodb/storage/tests/test_virgin.py:1.2	Wed Dec 25 09:12:20 2002
+++ ZODB4/src/zodb/storage/tests/test_virgin.py	Wed Jan 22 15:55:53 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,
@@ -14,17 +14,14 @@
 
 # Test creation of a brand new database, and insertion of root objects.
 
-try:
-    import bsddb3
-except ImportError:
-    raise RuntimeError, 'BerkeleyDB not available'
-
 import unittest
 
-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 InsertMixin:
@@ -52,8 +49,9 @@
 
 def test_suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(MinimalNewInsertsTest, 'check'))
-    suite.addTest(unittest.makeSuite(FullNewInsertsTest, 'check'))
+    if berkeley_is_available:
+        suite.addTest(unittest.makeSuite(MinimalNewInsertsTest, 'check'))
+        suite.addTest(unittest.makeSuite(FullNewInsertsTest, 'check'))
     return suite