home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 June / PCWorld_2005-06_cd.bin / software / vyzkuste / firewally / firewally.exe / framework-2.3.exe / test_all.py < prev    next >
Text File  |  2003-12-30  |  2KB  |  82 lines

  1. """Run all test cases.
  2. """
  3.  
  4. import sys
  5. import os
  6. import unittest
  7.  
  8. verbose = 0
  9. if 'verbose' in sys.argv:
  10.     verbose = 1
  11.     sys.argv.remove('verbose')
  12.  
  13. if 'silent' in sys.argv:  # take care of old flag, just in case
  14.     verbose = 0
  15.     sys.argv.remove('silent')
  16.  
  17.  
  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
  34.  
  35.  
  36. class PrintInfoFakeTest(unittest.TestCase):
  37.     def testPrintVersions(self):
  38.         print_versions()
  39.  
  40.  
  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
  46.  
  47.  
  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',
  64.         ]
  65.  
  66.     alltests = unittest.TestSuite()
  67.     for name in test_modules:
  68.         module = __import__(name)
  69.         alltests.addTest(module.suite())
  70.     return alltests
  71.  
  72.  
  73. def test_suite():
  74.     suite = unittest.TestSuite()
  75.     suite.addTest(unittest.makeSuite(PrintInfoFakeTest))
  76.     return suite
  77.  
  78.  
  79. if __name__ == '__main__':
  80.     print_versions()
  81.     unittest.main(defaultTest='suite')
  82.