/usr/share/pyshared/mvpa/tests/main.py is in python-mvpa 0.4.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""Unit test console interface for PyMVPA"""
import unittest
import sys
import numpy as np
from mvpa import _random_seed, cfg
from mvpa.base import externals, warning
from mvpa.tests import collectTestSuites
def main():
if __debug__:
from mvpa.base import debug
# Lets add some targets which provide additional testing
debug.active += ['CHECK_.*']
# NOTE: it had to be done here instead of test_clf.py for
# instance, since for CHECK_RETRAIN it has to be set before object
# gets created, ie while importing clfs.warehouse
suites = collectTestSuites()
# and make global test suite
ts = unittest.TestSuite(suites.values())
class TextTestRunnerPyMVPA(unittest.TextTestRunner):
"""Extend TextTestRunner to print out random seed which was
used in the case of failure"""
def run(self, test):
result = super(TextTestRunnerPyMVPA, self).run(test)
if not result.wasSuccessful():
print "MVPA_SEED=%s" % _random_seed
sys.exit(1)
return result
verbosity = int(cfg.get('tests', 'verbosity', default=1))
if verbosity < 3:
# no MVPA warnings during whole testsuite (but restore handlers later on)
handler_backup = warning.handlers
warning.handlers = []
# No python warnings (like ctypes version for slmr)
import warnings
warnings.simplefilter('ignore')
# No numpy
np_errsettings = np.geterr()
np.seterr(**dict([(x, 'ignore') for x in np_errsettings]))
# finally run it
TextTestRunnerPyMVPA(verbosity=verbosity).run(ts)
if verbosity < 3:
# restore warning handlers
warning.handlers = handler_backup
np.seterr(**np_errsettings)
if __name__ == '__main__':
main()
|