blob: 34555ff33b93a5383479ed81f9e9b0301e5d2e68 [file] [log] [blame]
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +00001# Test driver for bsddb package.
2"""
3Run all test cases.
4"""
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +00005import sys
6import unittest
7from test.test_support import requires, verbose, run_suite
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +00008
Barry Warsaw0a262352002-12-30 20:53:18 +00009# When running as a script instead of within the regrtest framework, skip the
10# requires test, since it's obvious we want to run them.
11if __name__ <> '__main__':
12 requires('bsddb')
13
14verbose = False
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +000015if 'verbose' in sys.argv:
Barry Warsaw0a262352002-12-30 20:53:18 +000016 verbose = True
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +000017 sys.argv.remove('verbose')
18
19if 'silent' in sys.argv: # take care of old flag, just in case
Barry Warsaw0a262352002-12-30 20:53:18 +000020 verbose = False
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +000021 sys.argv.remove('silent')
22
23
24def suite():
Neal Norwitz62a21122006-01-25 05:21:55 +000025 try:
26 # this is special, it used to segfault the interpreter
27 import bsddb.test.test_1413192
28 except:
29 pass
30
Barry Warsaw0a262352002-12-30 20:53:18 +000031 test_modules = [
32 'test_associate',
33 'test_basics',
34 'test_compat',
35 'test_dbobj',
36 'test_dbshelve',
37 'test_dbtables',
38 'test_env_close',
39 'test_get_none',
40 'test_join',
41 'test_lock',
42 'test_misc',
43 'test_queue',
44 'test_recno',
45 'test_thread',
46 ]
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +000047
48 alltests = unittest.TestSuite()
49 for name in test_modules:
50 module = __import__("bsddb.test."+name, globals(), locals(), name)
Barry Warsaw0a262352002-12-30 20:53:18 +000051 #print module,name
52 alltests.addTest(module.test_suite())
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +000053 return alltests
54
Barry Warsaw0a262352002-12-30 20:53:18 +000055
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +000056# For invocation through regrtest
57def test_main():
58 tests = suite()
59 run_suite(tests)
60
Barry Warsaw0a262352002-12-30 20:53:18 +000061
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +000062# For invocation as a script
63if __name__ == '__main__':
64 from bsddb import db
65 print '-=' * 38
66 print db.DB_VERSION_STRING
Barry Warsaw0a262352002-12-30 20:53:18 +000067 print 'bsddb.db.version(): %s' % (db.version(),)
68 print 'bsddb.db.__version__: %s' % db.__version__
69 print 'bsddb.db.cvsid: %s' % db.cvsid
Martin v. Löwis1c6b1a22002-11-19 17:47:07 +000070 print 'python version: %s' % sys.version
71 print '-=' * 38
72
Barry Warsaw0a262352002-12-30 20:53:18 +000073 unittest.main(defaultTest='suite')