Source code for tables.tests.test_suite

"""Test suite consisting of all testcases."""

import sys

from tables.tests import common
from tables.tests.common import unittest
from tables.tests.common import print_heavy, print_versions

def suite():
    test_modules = [
        # Sub-packages

    # print('-=' * 38)

    # The test for garbage must be run *in the last place*.
    # Else, it is not as useful.

    alltests = unittest.TestSuite()
    if common.show_memory:
        # Add a memory report at the beginning
    for name in test_modules:
        # Unexpectedly, the following code doesn't seem to work anymore
        # in python 3
        # exec('from %s import suite as test_suite' % name)
        test_suite = sys.modules[name].suite

        if common.show_memory:
            # Add a memory report after each test module
    return alltests

[docs]def test(verbose=False, heavy=False): """Run all the tests in the test suite. If *verbose* is set, the test suite will emit messages with full verbosity (not recommended unless you are looking into a certain problem). If *heavy* is set, the test suite will be run in *heavy* mode (you should be careful with this because it can take a lot of time and resources from your computer). Return 0 (os.EX_OK) if all tests pass, 1 in case of failure """ print_versions() print_heavy(heavy) # What a context this is! #oldverbose, common.verbose = common.verbose, verbose oldheavy, common.heavy = common.heavy, heavy try: result = unittest.TextTestRunner(verbosity=1+int(verbose)).run(suite()) if result.wasSuccessful(): return 0 else: return 1 finally: #common.verbose = oldverbose common.heavy = oldheavy # there are pretty young heavies, too ;)