python-2.5.2/win32/Lib/test/test_bsddb3.py
changeset 0 ae805ac0140d
equal deleted inserted replaced
-1:000000000000 0:ae805ac0140d
       
     1 # Test driver for bsddb package.
       
     2 """
       
     3 Run all test cases.
       
     4 """
       
     5 import sys
       
     6 import unittest
       
     7 from test.test_support import requires, verbose, run_suite, unlink
       
     8 
       
     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
       
    15 if 'verbose' in sys.argv:
       
    16     verbose = True
       
    17     sys.argv.remove('verbose')
       
    18 
       
    19 if 'silent' in sys.argv:  # take care of old flag, just in case
       
    20     verbose = False
       
    21     sys.argv.remove('silent')
       
    22 
       
    23 
       
    24 def suite():
       
    25     try:
       
    26         # this is special, it used to segfault the interpreter
       
    27         import bsddb.test.test_1413192
       
    28     except:
       
    29         for f in ['__db.001', '__db.002', '__db.003', 'log.0000000001']:
       
    30             unlink(f)
       
    31 
       
    32     test_modules = [
       
    33         'test_associate',
       
    34         'test_basics',
       
    35         'test_compat',
       
    36         'test_dbobj',
       
    37         'test_dbshelve',
       
    38         'test_dbtables',
       
    39         'test_env_close',
       
    40         'test_get_none',
       
    41         'test_join',
       
    42         'test_lock',
       
    43         'test_misc',
       
    44         'test_queue',
       
    45         'test_recno',
       
    46         'test_thread',
       
    47         'test_sequence',
       
    48         'test_cursor_pget_bug',
       
    49         ]
       
    50 
       
    51     alltests = unittest.TestSuite()
       
    52     for name in test_modules:
       
    53         module = __import__("bsddb.test."+name, globals(), locals(), name)
       
    54         #print module,name
       
    55         alltests.addTest(module.test_suite())
       
    56     return alltests
       
    57 
       
    58 
       
    59 # For invocation through regrtest
       
    60 def test_main():
       
    61     tests = suite()
       
    62     run_suite(tests)
       
    63 
       
    64 
       
    65 # For invocation as a script
       
    66 if __name__ == '__main__':
       
    67     from bsddb import db
       
    68     print '-=' * 38
       
    69     print db.DB_VERSION_STRING
       
    70     print 'bsddb.db.version():   %s' % (db.version(),)
       
    71     print 'bsddb.db.__version__: %s' % db.__version__
       
    72     print 'bsddb.db.cvsid:       %s' % db.cvsid
       
    73     print 'python version:        %s' % sys.version
       
    74     print '-=' * 38
       
    75 
       
    76     unittest.main(defaultTest='suite')