0001 """Run all test cases. 0002 """ 0003 0004 import sys 0005 import os 0006 import unittest 0007 0008 verbose = 0 0009 if 'verbose' in sys.argv: 0010 verbose = 1 0011 sys.argv.remove('verbose') 0012 0013 if 'silent' in sys.argv: # take care of old flag, just in case 0014 verbose = 0 0015 sys.argv.remove('silent') 0016 0017 0018 def print_versions(): 0019 try: 0020 # For Pythons w/distutils pybsddb 0021 from bsddb3 import db 0022 except ImportError: 0023 # For Python 2.3 0024 from bsddb import db 0025 print 0026 print '-=' * 38 0027 print db.DB_VERSION_STRING 0028 print 'bsddb.db.version(): %s' % (db.version(), ) 0029 print 'bsddb.db.__version__: %s' % db.__version__ 0030 print 'bsddb.db.cvsid: %s' % db.cvsid 0031 print 'python version: %s' % sys.version 0032 print 'My pid: %s' % os.getpid() 0033 print '-=' * 38 0034 0035 0036 class PrintInfoFakeTest(unittest.TestCase): 0037 def testPrintVersions(self): 0038 print_versions() 0039 0040 0041 # This little hack is for when this module is run as main and all the 0042 # other modules import it so they will still be able to get the right 0043 # verbose setting. It's confusing but it works. 0044 import test_all 0045 test_all.verbose = verbose 0046 0047 0048 def suite(): 0049 test_modules = [ 0050 'test_associate', 0051 'test_basics', 0052 'test_compat', 0053 'test_dbobj', 0054 'test_dbshelve', 0055 'test_dbtables', 0056 'test_env_close', 0057 'test_get_none', 0058 'test_join', 0059 'test_lock', 0060 'test_misc', 0061 'test_queue', 0062 'test_recno', 0063 'test_thread', 0064 ] 0065 0066 alltests = unittest.TestSuite() 0067 for name in test_modules: 0068 module = __import__(name) 0069 alltests.addTest(module.test_suite()) 0070 return alltests 0071 0072 0073 def test_suite(): 0074 suite = unittest.TestSuite() 0075 suite.addTest(unittest.makeSuite(PrintInfoFakeTest)) 0076 return suite 0077 0078 0079 if __name__ == '__main__': 0080 print_versions() 0081 unittest.main(defaultTest='suite') 0082
Generated by PyXR 0.9.4