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

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


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

Modified Files:
	test_whitebox.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_whitebox.py 1.2 => 1.3 ===
--- ZODB4/src/zodb/storage/tests/test_whitebox.py:1.2	Wed Dec 25 09:12:20 2002
+++ ZODB4/src/zodb/storage/tests/test_whitebox.py	Wed Jan 22 15:57:38 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,13 +14,12 @@
 
 # Whitebox testing of storage implementation details.
 
-try:
-    import bsddb3
-except ImportError:
-    raise RuntimeError, 'BerkeleyDB not available'
-
 import unittest
 
+from persistence import Persistent
+from transaction import get_transaction
+
+from zodb.storage.base import berkeley_is_available, ZERO
 from zodb.storage.tests.minpo import MinPO
 from zodb.storage.tests.base import zodb_unpickle
 from zodb.storage.bdbfull import BDBFullStorage
@@ -28,11 +27,6 @@
 from zodb.storage.tests.base import BerkeleyTestBase
 from zodb.storage.tests.base import ZODBTestBase
 
-from persistence import Persistent
-from transaction import get_transaction
-
-ZERO = '\0'*8
-
 
 
 class Object(Persistent):
@@ -223,9 +217,10 @@
 
 def test_suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(WhiteboxLowLevelMinimal, 'check'))
-    suite.addTest(unittest.makeSuite(WhiteboxHighLevelMinimal, 'check'))
-    suite.addTest(unittest.makeSuite(WhiteboxHighLevelFull, 'check'))
+    if berkeley_is_available:
+        suite.addTest(unittest.makeSuite(WhiteboxLowLevelMinimal, 'check'))
+        suite.addTest(unittest.makeSuite(WhiteboxHighLevelMinimal, 'check'))
+        suite.addTest(unittest.makeSuite(WhiteboxHighLevelFull, 'check'))
     return suite