summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bsddb3.py
blob: 15ed1e471a9f8dd43fc5c2d16d6effcc5027c6ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Test driver for bsddb package.
"""
Run all test cases.
"""
import sys
import unittest
import test.test_support
from test.test_support import requires, run_unittest, unlink

# When running as a script instead of within the regrtest framework, skip the
# requires test, since it's obvious we want to run them.
if __name__ != '__main__':
    requires('bsddb')

import bsddb.test.test_all
if 'verbose' in sys.argv:
    bsddb.test.test_all.verbose = 1
    sys.argv.remove('verbose')

if 'silent' in sys.argv:  # take care of old flag, just in case
    bsddb.test.test_all.verbose = 0
    sys.argv.remove('silent')


def suite():
    try:
        # this is special, it used to segfault the interpreter
        import bsddb.test.test_1413192
    finally:
        for f in ['xxx.db','__db.001','__db.002','__db.003','log.0000000001']:
            unlink(f)

    test_modules = [
        'test_associate',
        'test_basics',
        'test_compat',
        'test_compare',
        'test_dbobj',
        'test_dbshelve',
        'test_dbtables',
        'test_env_close',
        'test_get_none',
        'test_join',
        'test_lock',
        'test_misc',
        'test_pickle',
        'test_queue',
        'test_recno',
        'test_thread',
        'test_sequence',
        'test_cursor_pget_bug',
        ]

    alltests = unittest.TestSuite()
    for name in test_modules:
        module = __import__("bsddb.test."+name, globals(), locals(), name)
        #print module,name
        alltests.addTest(module.test_suite())
    return alltests


# For invocation through regrtest
def test_main():
    run_unittest(suite())

# For invocation as a script
if __name__ == '__main__':
    from bsddb import db
    print('-=' * 38)
    print(db.DB_VERSION_STRING)
    print('bsddb.db.version():   %s' % (db.version(),))
    print('bsddb.db.__version__: %s' % db.__version__)
    print('bsddb.db.cvsid:       %s' % db.cvsid)
    print('python version:        %s' % sys.version)
    print('-=' * 38)

    test_main()