Skip to content

Commit 6ca155b

Browse files
committed
added anon-cmd unit test. verified in py36 and py27
ready for pr
1 parent 17439ea commit 6ca155b

File tree

9 files changed

+8
-27
lines changed

9 files changed

+8
-27
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ RUN apt-get update -qq \
7171
libc-dev \
7272
git-annex-standalone \
7373
netbase \
74-
vim \
7574
&& apt-get clean \
7675
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
7776

@@ -148,6 +147,7 @@ RUN echo '{ \
148147
\n "traits>=4.6.0", \
149148
\n "scipy", \
150149
\n "numpy", \
150+
\n "pandas", \
151151
\n "nomkl" \
152152
\n ], \
153153
\n "pip_install": [ \

heudiconv/cli/run.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ..utils import load_heuristic, anonymize_sid, treat_infofile, SeqInfo
99
from ..convert import prep_conversion
1010
from ..bids import populate_bids_templates, tuneup_bids_json_files
11-
from ..slurmqueue import queue_conversion
11+
from ..queue import queue_conversion
1212

1313
import inspect
1414
import logging
@@ -306,12 +306,7 @@ def process_args(args):
306306

307307
anon_sid = anonymize_sid(sid, args.anon_cmd) if args.anon_cmd else None
308308
if args.anon_cmd:
309-
import sys
310-
lgr.info('DEBUGC-version {}'.format(sys.version))
311-
lgr.info('DEBUGC-execpath {}'.format(sys.executable))
312309
lgr.info('Anonymized {} to {}'.format(sid, anon_sid))
313-
lgr.info('DEBUGC-type_to_match {}'.format(type(sid)))
314-
lgr.info('DEBUGC-type_returned {}'.format(type(anon_sid)))
315310

316311
study_outdir = op.join(outdir, locator or '')
317312
anon_outdir = args.conv_outdir or outdir
File renamed without changes.

heudiconv/tests/anonymize_script.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/annex/objects/SHA256E-s305--d13f986ddc4e3ba2a9fdea076834eb9861cddd365380d5675ebdf1177281f352.py

heudiconv/tests/data/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

heudiconv/tests/data/anonymize_script.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

heudiconv/tests/test_regression.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919

2020
@pytest.mark.parametrize('subject', ['sub-sid000143'])
2121
@pytest.mark.parametrize('heuristic', ['reproin.py'])
22-
# @pytest.mark.parametrize('anon_cmd', [None]) # ['anonymize_script.py']
23-
@pytest.mark.parametrize('anon_cmd', [None, 'anonymize_script.py']) #
22+
@pytest.mark.parametrize('anon_cmd', [None, 'anonymize_script.py'])
2423
@pytest.mark.skipif(not have_datalad, reason="no datalad")
2524
def test_conversion(tmpdir, subject, heuristic, anon_cmd):
2625
tmpdir.chdir()

heudiconv/tests/utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@ def gen_heudiconv_args(datadir, outdir, subject, heuristic_file, anon_cmd=None,
1414
"-f", heuristic,
1515
"--bids",]
1616
if anon_cmd:
17-
args += ["--anon-cmd", op.join(op.dirname(__file__), 'data', anon_cmd), "-a", outdir]
17+
args += ["--anon-cmd", op.join(op.dirname(__file__), anon_cmd), "-a", outdir]
1818
if xargs:
1919
args += xargs
20-
21-
print("DEBUGC-args")
22-
print(args)
2320

2421
return args
2522

heudiconv/utils.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,25 +103,16 @@ def dec(obj):
103103

104104

105105
def anonymize_sid(sid, anon_sid_cmd):
106-
from subprocess import check_output
107106
import sys
108-
print('DEBUGC-version {}'.format(sys.version))
109-
print('DEBUGC-execpath {}'.format(sys.executable))
110-
111-
type_to_match = type(sid)
107+
from subprocess import check_output
112108

113109
cmd = [anon_sid_cmd, sid]
114110
shell_return = check_output(cmd)
115111

112+
type_to_match = type(sid)
116113
type_returned = type(shell_return)
117114

118-
print('DEBUGC-type_to_match {}'.format(type_to_match))
119-
print('DEBUGC-type_returned {}'.format(type_returned))
120-
121-
# if type_to_match not type_returned:
122-
# if sys.version_info[0] < 3:
123-
# if type_to_match
124-
115+
### Handle subprocess returning a bytes literal string to a python3 interpreter
125116
if all([sys.version_info[0] > 2, isinstance(shell_return, bytes), isinstance(sid, str)]):
126117
anon_sid = shell_return.decode()
127118
else:

0 commit comments

Comments
 (0)