def test_utils_help(args, capsys, platform): argv = ['cpac', *args.split(' '), 'group', '--help'] with mock.patch.object(sys, 'argv', [arg for arg in argv if len(arg)]): run() captured = capsys.readouterr() assert platform.title() in captured.out assert 'COMMAND' in captured.out
def test_run_test_config(args, tmp_path): wd = tmp_path argv = (f'cpac {args} run ' f's3://fcp-indi/data/Projects/ABIDE/RawDataBIDS/NYU {wd} ' 'test_config --participant_ndx=2').split(' ') with mock.patch.object(sys, 'argv', argv): run() assert (any([date.today().isoformat() in fp for fp in os.listdir(wd)]))
def test_utils_new_settings_template(args, tmp_path): wd = tmp_path argv = (f'cpac {args} --working_dir {wd} --temp_dir {wd} ' f'utils data_config new_settings_template').split(' ') with mock.patch.object(sys, 'argv', argv): run() template_path = os.path.join(wd, 'data_settings.yml') assert (os.path.exists(template_path))
def test_cpac_crash(args, capsys): crashfile = os.path.join( os.path.dirname(__file__), 'test_data', 'test_pickle.pklz' ) argv = ( f'cpac {args} crash {crashfile}' ).split(' ') with mock.patch.object(sys, 'argv', argv): run() captured = capsys.readouterr() assert("MemoryError" in captured.out or "MemoryError" in captured.err)
def test_run_help(args, capsys, helpflag): argv = ['cpac', *args.split(' '), 'run', helpflag] with mock.patch.object(sys, 'argv', argv): run() captured = capsys.readouterr() assert 'participant' in captured.out or 'participant' in captured.err