dax/dax_tools_utils.py
def testing(test_file, project, sessions, host=None, username=None, hide=False,
            do_not_remove=False, nb_sess=5):
    """
    Function to run test on some files for dax.

    :param test_file: file to test
    :param project: project ID on XNAT
    :param sessions: list of sessions to run on XNAT
    :param host: XNAT host
    :param username: XNAT username
    :param hide: Hide dax outputs in a logfile in ~/.dax_test/dax_test.log.
    :param do_not_remove: do not remove files generated
    :param nb_sess: number of sessions to process(default 5 maximum)
    """
    # Create test results class object:
    tests = test_results()

    # Load test_file:
    test_obj = load_test(test_file)

    if not test_obj:
        tests.inc_error()
    else:
        _host = host if host is not None else os.environ.get('XNAT_HOST', None)
        _user = username if username is not None else 'user in dax netrc file.'
        if isinstance(test_obj, launcher.Launcher):
            _host = test_obj.xnat_host
            _user = test_obj.xnat_user

        print(TD_INFO.format(platform=platform.system(),
                             version=platform.python_version(),
                             dax_version=__version__,
                             host=_host, user=_user))
        # set test object:
        tests.set_tobj(test_obj)

        # Make the temp dir:
        if not os.path.isdir(DAX_TEST_DIR):
            os.makedirs(DAX_TEST_DIR)

        # Set the log of any dax function to a temp file for user:
        if hide:
            logfile = os.path.join(DAX_TEST_DIR, 'dax_test.log')
        else:
            logfile = None
        log.setup_debug_logger('dax', logfile)

        with XnatUtils.get_interface(host=_host, user=username) as xnat:
            tests.set_xnat(xnat)
            tests.run_test(project, sessions, nb_sess)

    print(TD_END.format(nb_test=tests.get_number(),
                        time="%.3f" % tests.get_time(),
                        state=tests.get_test_state()))

    if do_not_remove:
        if 'OK' == tests.get_test_state()[:2]:
            shutil.rmtree(DAX_TEST_DIR)

    Function to run test on some files for dax.

    :param test_file: file to test
    :param project: project ID on XNAT
    :param sessions: list of sessions to run on XNAT
    :param host: XNAT host
    :param username: XNAT username
    :param hide: Hide dax outputs in a logfile in ~/.dax_test/dax_test.log.
    :param do_not_remove: do not remove files generated
    :param nb_sess: number of sessions to process(default 5 maximum)
    
Function to run test on some files for dax.
Function to run test on some files for dax .
def testing(test_file, project, sessions, host=None, username=None, hide=False,
            do_not_remove=False, nb_sess=5):
    tests = test_results()
    test_obj = load_test(test_file)
    if not test_obj:
        tests.inc_error()
    else:
        _host = host if host is not None else os.environ.get('XNAT_HOST', None)
        _user = username if username is not None else 'user in dax netrc file.'
        if isinstance(test_obj, launcher.Launcher):
            _host = test_obj.xnat_host
            _user = test_obj.xnat_user
        print(TD_INFO.format(platform=platform.system(),
                             version=platform.python_version(),
                             dax_version=__version__,
                             host=_host, user=_user))
        tests.set_tobj(test_obj)
        if not os.path.isdir(DAX_TEST_DIR):
            os.makedirs(DAX_TEST_DIR)
        if hide:
            logfile = os.path.join(DAX_TEST_DIR, 'dax_test.log')
        else:
            logfile = None
        log.setup_debug_logger('dax', logfile)
        with XnatUtils.get_interface(host=_host, user=username) as xnat:
            tests.set_xnat(xnat)
            tests.run_test(project, sessions, nb_sess)
    print(TD_END.format(nb_test=tests.get_number(),
                        time="%.3f" % tests.get_time(),
                        state=tests.get_test_state()))
    if do_not_remove:
        if 'OK' == tests.get_test_state()[:2]:
            shutil.rmtree(DAX_TEST_DIR)
def testing ( test_file , project , sessions , host = None , username = None , hide = False , do_not_remove = False , nb_sess = 5 ) : tests = test_results ( ) test_obj = load_test ( test_file ) if not test_obj : tests . inc_error ( ) else : _host = host if host is not None else os . environ . get ( 'XNAT_HOST' , None ) _user = username if username is not None else 'user in dax netrc file.' if isinstance ( test_obj , launcher . Launcher ) : _host = test_obj . xnat_host _user = test_obj . xnat_user print ( TD_INFO . format ( platform = platform . system ( ) , version = platform . python_version ( ) , dax_version = __version__ , host = _host , user = _user ) ) tests . set_tobj ( test_obj ) if not os . path . isdir ( DAX_TEST_DIR ) : os . makedirs ( DAX_TEST_DIR ) if hide : logfile = os . path . join ( DAX_TEST_DIR , 'dax_test.log' ) else : logfile = None log . setup_debug_logger ( 'dax' , logfile ) with XnatUtils . get_interface ( host = _host , user = username ) as xnat : tests . set_xnat ( xnat ) tests . run_test ( project , sessions , nb_sess ) print ( TD_END . format ( nb_test = tests . get_number ( ) , time = "%.3f" % tests . get_time ( ) , state = tests . get_test_state ( ) ) ) if do_not_remove : if 'OK' == tests . get_test_state ( ) [ : 2 ] : shutil . rmtree ( DAX_TEST_DIR )
Function to run test on some files for dax.
Function to run test on some files for dax .
"""
    Function to run test on some files for dax.

    :param test_file: file to test
    :param project: project ID on XNAT
    :param sessions: list of sessions to run on XNAT
    :param host: XNAT host
    :param username: XNAT username
    :param hide: Hide dax outputs in a logfile in ~/.dax_test/dax_test.log.
    :param do_not_remove: do not remove files generated
    :param nb_sess: number of sessions to process(default 5 maximum)
    """ # Create test results class object: # Load test_file: # set test object: # Make the temp dir: # Set the log of any dax function to a temp file for user:
test_file
file to test
file to test
project
project ID on XNAT
project ID on XNAT
sessions
list of sessions to run on XNAT
list of sessions to run on XNAT
host
None
username
None
hide
Hide dax outputs in a logfile in ~/.dax_test/dax_test.log.
Hide dax outputs in a logfile in ~ / . dax_test / dax_test . log .
do_not_remove
do not remove files generated
do not remove files generated
nb_sess
number of sessions to process(default 5 maximum)
number of sessions to process ( default 5 maximum )