~pythonregexp2.7/python/issue2636-12

« back to all changes in this revision

Viewing changes to Lib/test/test_bsddb3.py

  • Committer: Jeffrey C. "The TimeHorse" Jacobs
  • Date: 2008-06-09 14:52:42 UTC
  • mfrom: (39033.1.3 Regexp-2.6)
  • Revision ID: darklord@timehorse.com-20080609145242-9m268zc6u87rp1vp
Merged in changes from the core Regexp branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
            sys.__stdout__.flush()
49
49
 
50
50
 
51
 
def suite():
52
 
    test_modules = [
53
 
        'test_associate',
54
 
        'test_basics',
55
 
        'test_compare',
56
 
        'test_compat',
57
 
        'test_cursor_pget_bug',
58
 
        'test_dbobj',
59
 
        'test_dbshelve',
60
 
        'test_dbtables',
61
 
        'test_distributed_transactions',
62
 
        'test_early_close',
63
 
        'test_get_none',
64
 
        'test_join',
65
 
        'test_lock',
66
 
        'test_misc',
67
 
        'test_pickle',
68
 
        'test_queue',
69
 
        'test_recno',
70
 
        'test_replication',
71
 
        'test_sequence',
72
 
        'test_thread',
73
 
        ]
74
 
 
75
 
    alltests = unittest.TestSuite()
76
 
    for name in test_modules:
77
 
        module = __import__("bsddb.test."+name, globals(), locals(), name)
78
 
        #print module,name
79
 
        alltests.addTest(module.test_suite())
80
 
        alltests.addTest(unittest.makeSuite(TimingCheck))
81
 
    return alltests
82
 
 
83
 
 
84
51
# For invocation through regrtest
85
52
def test_main():
86
 
    run_unittest(suite())
87
 
    db_home = os.path.join(tempfile.gettempdir(), 'db_home')
88
 
    # The only reason to remove db_home is in case if there is an old
89
 
    # one lying around.  This might be by a different user, so just
90
 
    # ignore errors.  We should always make a unique name now.
 
53
    from bsddb import db
 
54
    from bsddb.test import test_all
 
55
    test_all.set_test_path_prefix(os.path.join(tempfile.gettempdir(),
 
56
                                 'z-test_bsddb3-%s' %
 
57
                                 os.getpid()))
 
58
    # Please leave this print in, having this show up in the buildbots
 
59
    # makes diagnosing problems a lot easier.
 
60
    print >>sys.stderr, db.DB_VERSION_STRING
 
61
    print >>sys.stderr, 'Test path prefix: ', test_all.get_test_path_prefix()
91
62
    try:
92
 
        rmtree(db_home)
93
 
    except:
94
 
        pass
95
 
    rmtree('db_home%d' % os.getpid())
96
 
 
97
 
# For invocation as a script
 
63
        run_unittest(test_all.suite(module_prefix='bsddb.test.',
 
64
                                    timing_check=TimingCheck))
 
65
    finally:
 
66
        # The only reason to remove db_home is in case if there is an old
 
67
        # one lying around.  This might be by a different user, so just
 
68
        # ignore errors.  We should always make a unique name now.
 
69
        try:
 
70
            test_all.remove_test_path_directory()
 
71
        except:
 
72
            pass
 
73
 
 
74
 
98
75
if __name__ == '__main__':
99
 
    from bsddb import db
100
 
    print '-=' * 38
101
 
    print db.DB_VERSION_STRING
102
 
    print 'bsddb.db.version():   %s' % (db.version(),)
103
 
    print 'bsddb.db.__version__: %s' % db.__version__
104
 
    print 'bsddb.db.cvsid:       %s' % db.cvsid
105
 
    print 'python version:        %s' % sys.version
106
 
    print '-=' * 38
107
 
 
108
76
    test_main()