Source

fsl / fsl / test / testall.py

Full commit
import os
import unittest

import make_dir_struct
import tutils

modules = [
    'test_fsltool',
    'test_functions',
    'test_interpreter',
    'test_interpreter_unit',
    'test_lexer'
]

DIR_STRUCT_FILE = 'struct.txt'

def main(args):
    try:
        import fsl.AST
    except ImportError:
        # FSL is not on sys.path, but it should be in
        # parent directory, so we add grandparent directory
        # to sys.path.
        parent = os.path.normpath(os.path.join(os.getcwd(), '../../'))
        sys.path.append(parent)
        import fsl.AST

    make_dir_struct.make_tree(DIR_STRUCT_FILE, tutils.ROOTDIR)

    mainSuite = unittest.TestSuite()
    for module in modules:
        suite = unittest.defaultTestLoader.loadTestsFromName(module)
        mainSuite.addTest(suite)

    unittest.TextTestRunner().run(mainSuite)

if __name__=='__main__':
    import sys
    main(sys.argv[1:])