|
14 | 14 | if __name__ != '__main__':
|
15 | 15 | requires('bsddb')
|
16 | 16 |
|
17 |
| -import bsddb.test.test_all |
| 17 | +verbose = False |
18 | 18 | if 'verbose' in sys.argv:
|
19 |
| - bsddb.test.test_all.verbose = 1 |
| 19 | + verbose = True |
20 | 20 | sys.argv.remove('verbose')
|
21 | 21 |
|
22 | 22 | if 'silent' in sys.argv: # take care of old flag, just in case
|
23 |
| - bsddb.test.test_all.verbose = 0 |
| 23 | + verbose = False |
24 | 24 | sys.argv.remove('silent')
|
25 | 25 |
|
26 | 26 |
|
@@ -48,66 +48,29 @@ def testCheckElapsedTime(self):
|
48 | 48 | sys.__stdout__.flush()
|
49 | 49 |
|
50 | 50 |
|
51 |
| -def suite(): |
52 |
| - try: |
53 |
| - # this is special, it used to segfault the interpreter |
54 |
| - import bsddb.test.test_1413192 |
55 |
| - finally: |
56 |
| - for f in ['xxx.db','__db.001','__db.002','__db.003','log.0000000001']: |
57 |
| - unlink(f) |
58 |
| - |
59 |
| - test_modules = [ |
60 |
| - 'test_associate', |
61 |
| - 'test_basics', |
62 |
| - 'test_compat', |
63 |
| - 'test_compare', |
64 |
| - 'test_dbobj', |
65 |
| - 'test_dbshelve', |
66 |
| - 'test_dbtables', |
67 |
| - 'test_env_close', |
68 |
| - 'test_get_none', |
69 |
| - 'test_join', |
70 |
| - 'test_lock', |
71 |
| - 'test_misc', |
72 |
| - 'test_pickle', |
73 |
| - 'test_queue', |
74 |
| - 'test_recno', |
75 |
| - 'test_thread', |
76 |
| - 'test_sequence', |
77 |
| - 'test_cursor_pget_bug', |
78 |
| - ] |
79 |
| - |
80 |
| - alltests = unittest.TestSuite() |
81 |
| - for name in test_modules: |
82 |
| - module = __import__("bsddb.test."+name, globals(), locals(), name) |
83 |
| - #print module,name |
84 |
| - alltests.addTest(module.test_suite()) |
85 |
| - alltests.addTest(unittest.makeSuite(TimingCheck)) |
86 |
| - return alltests |
87 |
| - |
88 |
| - |
89 | 51 | # For invocation through regrtest
|
90 | 52 | def test_main():
|
91 |
| - run_unittest(suite()) |
92 |
| - db_home = os.path.join(tempfile.gettempdir(), 'db_home') |
93 |
| - # The only reason to remove db_home is in case if there is an old |
94 |
| - # one lying around. This might be by a different user, so just |
95 |
| - # 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(db.DB_VERSION_STRING, file=sys.stderr) |
| 61 | + print('Test path prefix: ', test_all.get_test_path_prefix(), file=sys.stderr) |
96 | 62 | try:
|
97 |
| - rmtree(db_home) |
98 |
| - except: |
99 |
| - pass |
100 |
| - rmtree('db_home%d' % os.getpid()) |
| 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 |
101 | 73 |
|
102 |
| -# For invocation as a script |
103 |
| -if __name__ == '__main__': |
104 |
| - from bsddb import db |
105 |
| - print('-=' * 38) |
106 |
| - print(db.DB_VERSION_STRING) |
107 |
| - print('bsddb.db.version(): %s' % (db.version(),)) |
108 |
| - print('bsddb.db.__version__: %s' % db.__version__) |
109 |
| - print('bsddb.db.cvsid: %s' % db.cvsid) |
110 |
| - print('python version: %s' % sys.version) |
111 |
| - print('-=' * 38) |
112 | 74 |
|
| 75 | +if __name__ == '__main__': |
113 | 76 | test_main()
|
0 commit comments