Commit d700dd19 authored by Barry Warsaw's avatar Barry Warsaw

Here's a principled way to determine whether the BDBStorages are

available or not, and also fixes to all the tests so they won't crap
out or complain if not.

To test whether these storages are avialable (including all package
dependencies), do:

import BDBStorage
if BDBStorage.is_available:
    # okay to use

Also, in BDBStorage/__init__.py do some cross-platform compatibility
for the bsddb module; in Python 2.3 we can just use the built-in
module, but in earlier Pythons we have to use bsddb3.  Now you can
just use "from BDBStorage import db" to get the proper db object.
parent 8fa5da0c
......@@ -75,11 +75,9 @@ class BDBReconnectionTests(
test_classes = [FileStorageConnectionTests, FileStorageReconnectionTests]
try:
from BDBStorage.BDBFullStorage import BDBFullStorage
except ImportError:
pass
else:
import BDBStorage
if BDBStorage.is_available:
test_classes.append(BDBConnectionTests)
test_classes.append(BDBReconnectionTests)
......
......@@ -175,11 +175,9 @@ class BDBTests(FileStorageTests):
test_classes = [FileStorageTests]
try:
from BDBStorage.BDBFullStorage import BDBFullStorage
except ImportError:
pass
else:
import BDBStorage
if BDBStorage.is_available:
test_classes.append(BDBTests)
......
......@@ -108,11 +108,9 @@ class BDBConfigTest(ConfigTestBase):
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(ZODBConfigTest))
try:
import BDBStorage.BDBFullStorage
except ImportError:
pass
else:
# Only run the Berkeley tests if they are available
import BDBStorage
if BDBStorage.is_available:
suite.addTest(unittest.makeSuite(BDBConfigTest))
return suite
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment