Package mvpa :: Package tests :: Module main
[hide private]
[frames] | no frames]

Source Code for Module mvpa.tests.main

 1  # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 
 2  # vi: set ft=python sts=4 ts=4 sw=4 et: 
 3  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## 
 4  # 
 5  #   See COPYING file distributed along with the PyMVPA package for the 
 6  #   copyright and license terms. 
 7  # 
 8  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## 
 9  """Unit test console interface for PyMVPA""" 
10   
11  import unittest 
12  import sys 
13   
14  from mvpa import _random_seed, cfg 
15  from mvpa.base import externals, warning 
16  from mvpa.tests import collectTestSuites 
17   
18   
19 -def main():
20 if __debug__: 21 from mvpa.base import debug 22 # Lets add some targets which provide additional testing 23 debug.active += ['CHECK_.*'] 24 # NOTE: it had to be done here instead of test_clf.py for 25 # instance, since for CHECK_RETRAIN it has to be set before object 26 # gets created, ie while importing clfs.warehouse 27 28 suites = collectTestSuites() 29 30 # and make global test suite 31 ts = unittest.TestSuite(suites.values()) 32 33 # no MVPA warnings during whole testsuite 34 warning.handlers = [] 35 36 # No python warnings (like ctypes version for slmr) 37 import warnings 38 warnings.simplefilter('ignore') 39 40 class TextTestRunnerPyMVPA(unittest.TextTestRunner): 41 """Extend TextTestRunner to print out random seed which was 42 used in the case of failure""" 43 def run(self, test): 44 result = super(TextTestRunnerPyMVPA, self).run(test) 45 if not result.wasSuccessful(): 46 print "MVPA_SEED=%s" % _random_seed 47 sys.exit(1) 48 return result
49 50 # finally run it 51 TextTestRunnerPyMVPA( 52 verbosity=int(cfg.get('tests', 'verbosity', default=1)) 53 ).run(ts) 54 55 56 if __name__ == '__main__': 57 main() 58