Skip to content

Commit 17439ea

Browse files
committed
passes unit test in boty py3.6 and py 2.7
1 parent 3cd30a2 commit 17439ea

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

heudiconv/cli/run.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,12 @@ 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))
309312
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)))
310315

311316
study_outdir = op.join(outdir, locator or '')
312317
anon_outdir = args.conv_outdir or outdir
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/annex/objects/SHA256E-s391--38015958888dd40f9c1872ee36a5a02587f010e0b2946be8ecd2f23c4970b07d.py
1+
/annex/objects/SHA256E-s336--b49382e4763607f62d142ff207fd8be214c7860661556a4a929e7edacd777a1f.py

heudiconv/tests/test_regression.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
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']
22+
# @pytest.mark.parametrize('anon_cmd', [None]) # ['anonymize_script.py']
23+
@pytest.mark.parametrize('anon_cmd', [None, 'anonymize_script.py']) #
2324
@pytest.mark.skipif(not have_datalad, reason="no datalad")
2425
def test_conversion(tmpdir, subject, heuristic, anon_cmd):
2526
tmpdir.chdir()

heudiconv/tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def gen_heudiconv_args(datadir, outdir, subject, heuristic_file, anon_cmd=None,
1818
if xargs:
1919
args += xargs
2020

21-
print("DEBUGCUSTOM1")
21+
print("DEBUGC-args")
2222
print(args)
2323

2424
return args

heudiconv/utils.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,29 @@ def dec(obj):
104104

105105
def anonymize_sid(sid, anon_sid_cmd):
106106
from subprocess import check_output
107+
import sys
108+
print('DEBUGC-version {}'.format(sys.version))
109+
print('DEBUGC-execpath {}'.format(sys.executable))
110+
111+
type_to_match = type(sid)
112+
107113
cmd = [anon_sid_cmd, sid]
108-
anon_sid = check_output(cmd)
114+
shell_return = check_output(cmd)
115+
116+
type_returned = type(shell_return)
117+
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+
125+
if all([sys.version_info[0] > 2, isinstance(shell_return, bytes), isinstance(sid, str)]):
126+
anon_sid = shell_return.decode()
127+
else:
128+
anon_sid = shell_return
129+
109130
return anon_sid.strip()
110131

111132

0 commit comments

Comments
 (0)