Skip to content

Commit 86607d7

Browse files
committed
fix: more general error, path as string
1 parent ad5a517 commit 86607d7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

heudiconv/queue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import subprocess
22
import sys
3+
import os
34

45
import logging
56

@@ -32,7 +33,6 @@ def queue_conversion(pyscript, queue, studyid, queue_args=None):
3233
raise NotImplementedError("Queuing with %s is not supported", queue)
3334

3435
args = sys.argv[1:]
35-
print(sys.argv)
3636
# search args for queue flag
3737
for i, arg in enumerate(args):
3838
if arg in ["-q", "--queue"]:
@@ -51,7 +51,7 @@ def queue_conversion(pyscript, queue, studyid, queue_args=None):
5151
convertcmd = " ".join(args)
5252

5353
# will overwrite across subjects
54-
queue_file = 'heudiconv-%s.sh' % queue
54+
queue_file = os.path.abspath('heudiconv-%s.sh' % queue)
5555
with open(queue_file, 'wt') as fp:
5656
fp.writelines(['#!/bin/bash\n', convertcmd, '\n'])
5757

heudiconv/tests/test_queue.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@ def test_queue_no_slurm(tmpdir, invocation):
1717
tmpdir.chdir()
1818
hargs = invocation.split(" ")
1919
hargs.extend(["-f", "reproin", "-b", "--minmeta", "--queue", "SLURM"])
20-
print(hargs)
2120

2221
# simulate command-line call
2322
_sys_args = sys.argv
2423
sys.argv = ['heudiconv'] + hargs
2524

2625
try:
27-
with pytest.raises(FileNotFoundError):
26+
with pytest.raises(OSError):
2827
runner(hargs)
2928
# should have generated a slurm submission script
30-
slurm_cmd_file = tmpdir / 'heudiconv-SLURM.sh'
29+
slurm_cmd_file = (tmpdir / 'heudiconv-SLURM.sh').strpath
3130
assert slurm_cmd_file
3231
# check contents and ensure args match
3332
with open(slurm_cmd_file) as fp:

0 commit comments

Comments
 (0)