Example #1
0
def setup_module(module, verbosity=None):
    "set up test fixtures for testing"

    if __debug__:
        from mvpa2.base import debug
        # Lets add some targets which provide additional testing
        debug.active += ['CHECK_.*']

    verbosity = _get_verbosity(verbosity)

    # provide people with a hint about the warnings that might show up in a
    # second
    if verbosity:
        print("T: MVPA_SEED=%s" % _random_seed)
        if verbosity > 1:
            print('T: Testing for availability of external software packages.')

    # fully test of externals
    verbosity_dependencies = max(0, verbosity - 1)
    if verbosity_dependencies:
        externals.check_all_dependencies(verbosity=verbosity_dependencies)
    elif __debug__ and verbosity:  # pragma: no cover
        print(
            'T: Skipping testing of all dependencies since verbosity '
            '(MVPA_TESTS_VERBOSITY) is too low')

    # So we could see all warnings about missing dependencies
    _sys_settings['maxcount'] = warning.maxcount
    warning.maxcount = 1000

    if verbosity < 3:
        # no MVPA warnings during whole testsuite (but restore handlers later on)
        _sys_settings['handlers'] = warning.handlers
        warning.handlers = []

        # No python warnings (like ctypes version for slmr)
        import warnings
        warnings.simplefilter('ignore')

    if verbosity < 4:
        # No NumPy
        _sys_settings['np_errsettings'] = np.geterr()
        np.seterr(**dict([(x, 'ignore')
                          for x in _sys_settings['np_errsettings']]))
Example #2
0
def setup_module(module, verbosity=None):
    "set up test fixtures for testing"

    if __debug__:
        from mvpa2.base import debug
        # Lets add some targets which provide additional testing
        debug.active += ['CHECK_.*']

    verbosity = _get_verbosity(verbosity)

    # provide people with a hint about the warnings that might show up in a
    # second
    if verbosity:
        print("T: MVPA_SEED=%s" % _random_seed)
        if verbosity > 1:
            print('T: Testing for availability of external software packages.')

    # fully test of externals
    verbosity_dependencies = max(0, verbosity - 1)
    if verbosity_dependencies:
        externals.check_all_dependencies(verbosity=verbosity_dependencies)
    elif __debug__ and verbosity: # pragma: no cover
        print('T: Skipping testing of all dependencies since verbosity '
              '(MVPA_TESTS_VERBOSITY) is too low')

    # So we could see all warnings about missing dependencies
    _sys_settings['maxcount'] = warning.maxcount
    warning.maxcount = 1000

    if verbosity < 3:
        # no MVPA warnings during whole testsuite (but restore handlers later on)
        _sys_settings['handlers'] = warning.handlers
        warning.handlers = []

        # No python warnings (like ctypes version for slmr)
        import warnings
        warnings.simplefilter('ignore')

    if verbosity < 4:
        # No NumPy
        _sys_settings['np_errsettings'] = np.geterr()
        np.seterr(**dict([(x, 'ignore') for x in _sys_settings['np_errsettings']]))