def function_launcher(args):
    # append local script to PYTHONPATH for import
    sys.path.append(os.path.join(sct.__sct_dir__, "testing"))
    # retrieve param class from sct_testing
    param_testing = sct_testing.Param()
    param_testing.function_to_test = args[0]
    param_testing.path_data = args[1]
    param_testing.args = args[2]
    param_testing.test_integrity = args[3]
    param_testing.redirect_stdout = True  # create individual logs for each subject.
    # load modules of function to test
    module_testing = importlib.import_module('test_' + param_testing.function_to_test)
    # initialize parameters specific to the test
    param_testing = module_testing.init(param_testing)
    try:
        param_testing = sct_testing.test_function(param_testing)
    except:
        import traceback
        logger.error('%s: %s' % ('test_' + args[0], traceback.format_exc()))
        # output = (1, 'ERROR: Function crashed', 'No result')
        from pandas import DataFrame
        # TODO: CHECK IF ASSIGNING INDEX WITH SUBJECT IS NECESSARY
        param_testing.results = DataFrame(index=[''], data={'status': int(1), 'output': 'ERROR: Function crashed.'})
        # status_script = 1
        # output_script = 'ERROR: Function crashed.'
        # output = (status_script, output_script, DataFrame(data={'status': int(status_script), 'output': output_script}, index=['']))

    # TODO: THE THING BELOW: IMPLEMENT INSIDE SCT_TESTING SUB-FUNCTION
    # sys.stdout.close()
    # sys.stdout = stdout_orig
    # # write log file
    # write_to_log_file(fname_log, output, mode='r+', prepend=True)

    return param_testing.results
def function_launcher(args):
    # append local script to PYTHONPATH for import
    path_sct = os.environ.get("SCT_DIR",
                              os.path.dirname(os.path.dirname(__file__)))
    sys.path.append(os.path.join(path_sct, "testing"))
    # retrieve param class from sct_testing
    param_testing = sct_testing.Param()
    param_testing.function_to_test = args[0]
    param_testing.path_data = args[1]
    param_testing.args = args[2]
    param_testing.test_integrity = args[3]
    param_testing.redirect_stdout = True  # create individual logs for each subject.
    # load modules of function to test
    module_testing = importlib.import_module('test_' +
                                             param_testing.function_to_test)
    # initialize parameters specific to the test
    param_testing = module_testing.init(param_testing)
    try:
        param_testing = sct_testing.test_function(param_testing)
    except:
        import traceback
        sct.log.error('%s: %s' % ('test_' + args[0], traceback.format_exc()))
        # output = (1, 'ERROR: Function crashed', 'No result')
        from pandas import DataFrame
        # TODO: CHECK IF ASSIGNING INDEX WITH SUBJECT IS NECESSARY
        param_testing.results = DataFrame(index=[''],
                                          data={
                                              'status': int(1),
                                              'output':
                                              'ERROR: Function crashed.'
                                          })
        # status_script = 1
        # output_script = 'ERROR: Function crashed.'
        # output = (status_script, output_script, DataFrame(data={'status': int(status_script), 'output': output_script}, index=['']))

    # TODO: THE THING BELOW: IMPLEMENT INSIDE SCT_TESTING SUB-FUNCTION
    # sys.stdout.close()
    # sys.stdout = stdout_orig
    # # write log file
    # write_to_log_file(fname_log, output, mode='r+', prepend=True)

    return param_testing.results