This commit was manufactured by cvs2svn to create tag 'r234'.
[python/dscho.git] / Lib / bsddb / test / test_all.py
blob415e118eb6326cf96910a4eb272d30ba0a0e93eb
1 """Run all test cases.
2 """
4 import sys
5 import os
6 import unittest
8 verbose = 0
9 if 'verbose' in sys.argv:
10 verbose = 1
11 sys.argv.remove('verbose')
13 if 'silent' in sys.argv: # take care of old flag, just in case
14 verbose = 0
15 sys.argv.remove('silent')
18 def print_versions():
19 try:
20 # For Python 2.3
21 from bsddb import db
22 except ImportError:
23 # For earlier Pythons w/distutils pybsddb
24 from bsddb3 import db
25 print
26 print '-=' * 38
27 print db.DB_VERSION_STRING
28 print 'bsddb.db.version(): %s' % (db.version(), )
29 print 'bsddb.db.__version__: %s' % db.__version__
30 print 'bsddb.db.cvsid: %s' % db.cvsid
31 print 'python version: %s' % sys.version
32 print 'My pid: %s' % os.getpid()
33 print '-=' * 38
36 class PrintInfoFakeTest(unittest.TestCase):
37 def testPrintVersions(self):
38 print_versions()
41 # This little hack is for when this module is run as main and all the
42 # other modules import it so they will still be able to get the right
43 # verbose setting. It's confusing but it works.
44 import test_all
45 test_all.verbose = verbose
48 def suite():
49 test_modules = [
50 'test_associate',
51 'test_basics',
52 'test_compat',
53 'test_dbobj',
54 'test_dbshelve',
55 'test_dbtables',
56 'test_env_close',
57 'test_get_none',
58 'test_join',
59 'test_lock',
60 'test_misc',
61 'test_queue',
62 'test_recno',
63 'test_thread',
66 alltests = unittest.TestSuite()
67 for name in test_modules:
68 module = __import__(name)
69 alltests.addTest(module.test_suite())
70 return alltests
73 def test_suite():
74 suite = unittest.TestSuite()
75 suite.addTest(unittest.makeSuite(PrintInfoFakeTest))
76 return suite
79 if __name__ == '__main__':
80 print_versions()
81 unittest.main(defaultTest='suite')