Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 1 | # Test driver for bsddb package. |
| 2 | """ |
| 3 | Run all test cases. |
| 4 | """ |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 5 | import sys |
| 6 | import unittest |
| 7 | from test.test_support import requires, verbose, run_suite |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 8 | |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 9 | # 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. |
| 11 | if __name__ <> '__main__': |
| 12 | requires('bsddb') |
| 13 | |
| 14 | verbose = False |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 15 | if 'verbose' in sys.argv: |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 16 | verbose = True |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 17 | sys.argv.remove('verbose') |
| 18 | |
| 19 | if 'silent' in sys.argv: # take care of old flag, just in case |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 20 | verbose = False |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 21 | sys.argv.remove('silent') |
| 22 | |
| 23 | |
| 24 | def suite(): |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 25 | test_modules = [ |
| 26 | 'test_associate', |
| 27 | 'test_basics', |
| 28 | 'test_compat', |
| 29 | 'test_dbobj', |
| 30 | 'test_dbshelve', |
| 31 | 'test_dbtables', |
| 32 | 'test_env_close', |
| 33 | 'test_get_none', |
| 34 | 'test_join', |
| 35 | 'test_lock', |
| 36 | 'test_misc', |
| 37 | 'test_queue', |
| 38 | 'test_recno', |
| 39 | 'test_thread', |
| 40 | ] |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 41 | |
| 42 | alltests = unittest.TestSuite() |
| 43 | for name in test_modules: |
| 44 | module = __import__("bsddb.test."+name, globals(), locals(), name) |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 45 | #print module,name |
| 46 | alltests.addTest(module.test_suite()) |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 47 | return alltests |
| 48 | |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 49 | |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 50 | # For invocation through regrtest |
| 51 | def test_main(): |
| 52 | tests = suite() |
| 53 | run_suite(tests) |
| 54 | |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 55 | |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 56 | # For invocation as a script |
| 57 | if __name__ == '__main__': |
| 58 | from bsddb import db |
| 59 | print '-=' * 38 |
| 60 | print db.DB_VERSION_STRING |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 61 | print 'bsddb.db.version(): %s' % (db.version(),) |
| 62 | print 'bsddb.db.__version__: %s' % db.__version__ |
| 63 | print 'bsddb.db.cvsid: %s' % db.cvsid |
Martin v. Löwis | 1c6b1a2 | 2002-11-19 17:47:07 +0000 | [diff] [blame] | 64 | print 'python version: %s' % sys.version |
| 65 | print '-=' * 38 |
| 66 | |
Barry Warsaw | 0a26235 | 2002-12-30 20:53:18 +0000 | [diff] [blame] | 67 | unittest.main(defaultTest='suite') |