diff --git a/fsl/tests/test_fslsub.py b/fsl/tests/test_fslsub.py index 5d59037be8b603fa1d28f20378918e361d67c834..38796cf05de29dc4e34a119718127b2684b8e3d1 100644 --- a/fsl/tests/test_fslsub.py +++ b/fsl/tests/test_fslsub.py @@ -239,45 +239,4 @@ def test_info(): assert res2['1'] is None with pytest.raises(ValueError): - fslsub._parse_qstat(valid_job_ids[0], example_qstat_reply) - - -def _good_func(): - print('hello') - - -def _bad_func(): - 1/0 - - -def test_func_to_cmd(): - cwd = os.getcwd() - with tempdir(): - for tmp_dir in (None, '.'): - for clean in ('never', 'on_success', 'always'): - for verbose in (False, True): - cmd = fslsub.func_to_cmd(_good_func, clean=clean, tmp_dir=tmp_dir, verbose=verbose) - fn = cmd.split()[-1] - assert op.exists(fn) - stdout, stderr, exitcode = run.run(cmd, exitcode=True, stdout=True, stderr=True, - env={"PYTHONPATH": cwd}) - assert exitcode == 0 - if clean == 'never': - assert op.exists(fn), "Successful job got removed, even though this was not requested" - else: - assert not op.exists(fn), f"Successful job did not get removed after run for clean = {clean}" - if verbose: - assert stdout.strip() == f'running "{fn}"\nhello' - else: - assert stdout.strip() == 'hello' - - cmd = fslsub.func_to_cmd(_bad_func, clean=clean, tmp_dir=tmp_dir) - fn = cmd.split()[-1] - assert op.exists(fn) - stdout, stderr, exitcode = run.run(cmd, exitcode=True, stdout=True, stderr=True, - env={'PYTHONPATH': cwd}) - assert exitcode != 0 - if clean == 'always': - assert not op.exists(fn), "Failing job should always be removed if requested" - else: - assert op.exists(fn), f"Failing job got removed even with clean = {clean}" + fslsub._parse_qstat(valid_job_ids[0], example_qstat_reply) \ No newline at end of file diff --git a/fsl/tests/test_run.py b/fsl/tests/test_run.py index abeb29dc6360312b0dcf19aba6d06198aa929932..55fe6baff02cf1c8fabda38d349e9dfb72918a2d 100644 --- a/fsl/tests/test_run.py +++ b/fsl/tests/test_run.py @@ -537,6 +537,6 @@ def test_func_to_cmd(): def test_job_output(): with tempdir.tempdir() as td: - with open('12345.e', 'wt') as f: f.write('error') - with open('12345.o', 'wt') as f: f.write('output') - assert run,job_output(12345, td) == ('output', 'error') + with open('test.e12345', 'wt') as f: f.write('error') + with open('test.o12345', 'wt') as f: f.write('output') + assert run.job_output(12345, td) == ('output', 'error')