From ba7ac161ae6d81fda5434da0fb6af54a81f813cb Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <MichielCottaar@protonmail.com> Date: Tue, 2 Apr 2024 14:59:23 +0100 Subject: [PATCH] Remove duplicate test_func_to_cmd test This test is already defined in test_run.py --- fsl/tests/test_fslsub.py | 43 +--------------------------------------- 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/fsl/tests/test_fslsub.py b/fsl/tests/test_fslsub.py index 5d59037be..38796cf05 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 -- GitLab