Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tables/tests/test_suite.py: 16%
25 statements
« prev ^ index » next coverage.py v7.2.5, created at 2023-05-10 06:15 +0000
« prev ^ index » next coverage.py v7.2.5, created at 2023-05-10 06:15 +0000
1"""Test suite consisting of all testcases."""
3import sys
5from tables.tests import common
8def suite():
9 test_modules = [
10 'tables.tests.test_attributes',
11 'tables.tests.test_basics',
12 'tables.tests.test_create',
13 'tables.tests.test_backcompat',
14 'tables.tests.test_types',
15 'tables.tests.test_lists',
16 'tables.tests.test_tables',
17 'tables.tests.test_tablesMD',
18 'tables.tests.test_large_tables',
19 'tables.tests.test_array',
20 'tables.tests.test_earray',
21 'tables.tests.test_carray',
22 'tables.tests.test_vlarray',
23 'tables.tests.test_tree',
24 'tables.tests.test_timetype',
25 'tables.tests.test_do_undo',
26 'tables.tests.test_enum',
27 'tables.tests.test_nestedtypes',
28 'tables.tests.test_hdf5compat',
29 'tables.tests.test_numpy',
30 'tables.tests.test_queries',
31 'tables.tests.test_expression',
32 'tables.tests.test_links',
33 'tables.tests.test_indexes',
34 'tables.tests.test_indexvalues',
35 'tables.tests.test_index_backcompat',
36 'tables.tests.test_aux',
37 'tables.tests.test_utils',
38 # Sub-packages
39 'tables.nodes.tests.test_filenode',
40 ]
42 # print('-=' * 38)
44 # The test for garbage must be run *in the last place*.
45 # Else, it is not as useful.
46 test_modules.append('tables.tests.test_garbage')
48 alltests = common.unittest.TestSuite()
49 if common.show_memory:
50 # Add a memory report at the beginning
51 alltests.addTest(common.unittest.makeSuite(common.ShowMemTime))
52 for name in test_modules:
53 # Unexpectedly, the following code doesn't seem to work anymore
54 # in python 3
55 # exec('from %s import suite as test_suite' % name)
56 __import__(name)
57 test_suite = sys.modules[name].suite
59 alltests.addTest(test_suite())
60 if common.show_memory:
61 # Add a memory report after each test module
62 alltests.addTest(common.unittest.makeSuite(common.ShowMemTime))
63 return alltests
66def test(verbose=False, heavy=False):
67 """Run all the tests in the test suite.
69 If *verbose* is set, the test suite will emit messages with full
70 verbosity (not recommended unless you are looking into a certain
71 problem).
73 If *heavy* is set, the test suite will be run in *heavy* mode (you
74 should be careful with this because it can take a lot of time and
75 resources from your computer).
77 Return 0 (os.EX_OK) if all tests pass, 1 in case of failure
79 """
81 common.print_versions()
82 common.print_heavy(heavy)
84 # What a context this is!
85 # oldverbose, common.verbose = common.verbose, verbose
86 oldheavy, common.heavy = common.heavy, heavy
87 try:
88 result = common.unittest.TextTestRunner(
89 verbosity=1 + int(verbose)).run(suite())
90 if result.wasSuccessful():
91 return 0
92 else:
93 return 1
94 finally:
95 # common.verbose = oldverbose
96 common.heavy = oldheavy # there are pretty young heavies, too ;)