Commit 8e8798e7 authored by Chris Withers's avatar Chris Withers

Changes to make BDBStorage tests display a message if they're run when BDBStorage is not available.

parent d8f18ad8
......@@ -18,7 +18,10 @@
import os
import errno
import shutil
import sys
import unittest
import BDBStorage
from BDBStorage.BerkeleyBase import BerkeleyConfig
from ZODB.tests.StorageTestBase import StorageTestBase
......@@ -77,3 +80,18 @@ class MinimalTestBase(BerkeleyTestBase):
class FullTestBase(BerkeleyTestBase):
from BDBStorage import BDBFullStorage
ConcreteStorage = BDBFullStorage.BDBFullStorage
def makeSuite(*args,**kw):
prefix = kw.get('prefix','check')
level = kw.get('level')
suite = unittest.TestSuite()
if level:
suite.level = level
if BDBStorage.is_available:
for klass in args:
suite.addTest(unittest.makeSuite(klass, prefix))
else:
sys.stderr.write("BDBStorage not available, tests disabled\n")
return suite
......@@ -533,16 +533,15 @@ class TestMinimalClassicPackRaceCondition(RaceConditionBase):
def test_suite():
suite = unittest.TestSuite()
suite.level = 2
if BDBStorage.is_available:
suite.addTest(unittest.makeSuite(TestAutopack))
suite.addTest(unittest.makeSuite(TestAutomaticClassicPack))
suite.addTest(unittest.makeSuite(TestMinimalPack))
suite.addTest(unittest.makeSuite(TestFullClassicPackRaceCondition))
suite.addTest(unittest.makeSuite(TestMinimalClassicPackRaceCondition))
return suite
return BDBStorage.tests.BerkeleyTestBase.makeSuite(
TestAutopack,
TestAutomaticClassicPack,
TestMinimalPack,
TestFullClassicPackRaceCondition,
TestMinimalClassicPackRaceCondition,
prefix='test',
level=2
)
if __name__ == '__main__':
......
......@@ -111,13 +111,14 @@ class OpenRecoveryTest(BerkeleyTestBase.FullTestBase):
def test_suite():
suite = unittest.TestSuite()
if BDBStorage.is_available:
suite.addTest(unittest.makeSuite(MinimalCreateTest))
suite.addTest(unittest.makeSuite(FullCreateTest))
suite.addTest(unittest.makeSuite(FullOpenExistingTest))
suite.addTest(unittest.makeSuite(FullOpenCloseTest))
suite.addTest(unittest.makeSuite(OpenRecoveryTest))
return BDBStorage.tests.BerkeleyTestBase.makeSuite(
MinimalCreateTest,
FullCreateTest,
FullOpenExistingTest,
FullOpenCloseTest,
OpenRecoveryTest,
prefix='test'
)
return suite
......
......@@ -77,13 +77,11 @@ class FullRecoveryTest(BerkeleyTestBase.FullTestBase,
def test_suite():
suite = unittest.TestSuite()
if BDBStorage.is_available:
suite.addTest(unittest.makeSuite(FullTest, 'check'))
suite.addTest(unittest.makeSuite(FullRecoveryTest, 'check'))
suite.addTest(unittest.makeSuite(MinimalTest, 'check'))
return suite
return BDBStorage.tests.BerkeleyTestBase.makeSuite(
FullTest,
FullRecoveryTest,
MinimalTest,
)
if __name__ == '__main__':
......
......@@ -46,12 +46,10 @@ class MinimalNewInsertsTest(ZODBTestBase, InsertMixin):
def test_suite():
suite = unittest.TestSuite()
if BDBStorage.is_available:
suite.addTest(unittest.makeSuite(MinimalNewInsertsTest, 'check'))
suite.addTest(unittest.makeSuite(FullNewInsertsTest, 'check'))
return suite
return BDBStorage.tests.BerkeleyTestBase.makeSuite(
MinimalNewInsertsTest,
FullNewInsertsTest,
)
if __name__ == '__main__':
......
......@@ -246,14 +246,12 @@ class WhiteboxHighLevelFull(ZODBTestBase):
def test_suite():
suite = unittest.TestSuite()
if BDBStorage.is_available:
suite.addTest(unittest.makeSuite(WhiteboxLowLevelMinimal, 'check'))
suite.addTest(unittest.makeSuite(WhiteboxHighLevelMinimal, 'check'))
suite.addTest(unittest.makeSuite(WhiteboxLowLevelFull, 'check'))
suite.addTest(unittest.makeSuite(WhiteboxHighLevelFull, 'check'))
return suite
return BDBStorage.tests.BerkeleyTestBase.makeSuite(
WhiteboxLowLevelMinimal,
WhiteboxHighLevelMinimal,
WhiteboxLowLevelFull,
WhiteboxHighLevelFull,
)
if __name__ == '__main__':
......
......@@ -78,13 +78,10 @@ class FullCommitAndRead(ZODBTestBase, CommitAndRead):
def test_suite():
suite = unittest.TestSuite()
if BDBStorage.is_available:
suite.addTest(unittest.makeSuite(MinimalCommitAndRead, 'check'))
suite.addTest(unittest.makeSuite(FullCommitAndRead, 'check'))
return suite
return BDBStorage.tests.BerkeleyTestBase.makeSuite(
MinimalCommitAndRead,
FullCommitAndRead
)
if __name__ == '__main__':
unittest.main(defaultTest='test_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