Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
2e46ebd3
Commit
2e46ebd3
authored
Feb 02, 2018
by
Paul McCarthy
🚵
Browse files
Updates to imcp/immv tests
parent
ab6a567b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_immv_imcp.py
View file @
2e46ebd3
...
@@ -337,17 +337,19 @@ def test_imcp_script_shouldPass(move=False):
...
@@ -337,17 +337,19 @@ def test_imcp_script_shouldPass(move=False):
reldir
=
tindir
reldir
=
tindir
toutdir
=
tindir
toutdir
=
tindir
infiles
=
os
.
listdir
(
tindir
)
if
not
move
:
infiles
=
os
.
listdir
(
tindir
)
files_to_expect
=
files_to_expect
+
' '
+
\
files_to_expect
=
files_to_expect
+
' '
+
\
' '
.
join
(
infiles
)
' '
.
join
(
infiles
)
for
inf
in
infiles
:
for
inf
in
infiles
:
img
=
nib
.
load
(
op
.
join
(
tindir
,
inf
))
img
=
nib
.
load
(
op
.
join
(
tindir
,
inf
))
imghash
=
hash
(
img
.
get_data
().
tobytes
())
imghash
=
hash
(
img
.
get_data
().
tobytes
())
imageHashes
.
append
(
imghash
)
imageHashes
.
append
(
imghash
)
print
(
'adj files_to_expect
expected
: '
,
files_to_expect
)
print
(
'adj files_to_expect: '
,
files_to_expect
)
os
.
chdir
(
reldir
)
os
.
chdir
(
reldir
)
...
@@ -369,9 +371,13 @@ def test_imcp_script_shouldPass(move=False):
...
@@ -369,9 +371,13 @@ def test_imcp_script_shouldPass(move=False):
checkFilesToExpect
(
checkFilesToExpect
(
files_to_expect
,
toutdir
,
outputType
,
imageHashes
)
files_to_expect
,
toutdir
,
outputType
,
imageHashes
)
if
move
:
# too hard if indir == outdir
if
move
and
tindir
!=
toutdir
:
real_print
(
'indir: '
,
tindir
)
real_print
(
'outdir: '
,
toutdir
)
infiles
=
os
.
listdir
(
tindir
)
infiles
=
os
.
listdir
(
tindir
)
infiles
=
[
f
for
f
in
infiles
if
op
.
isfile
(
f
)]
infiles
=
[
f
for
f
in
infiles
if
op
.
isfile
(
f
)]
infiles
=
[
f
for
f
in
infiles
if
op
.
isfile
(
f
)]
assert
len
(
infiles
)
==
0
assert
len
(
infiles
)
==
0
cleardir
(
indir
)
cleardir
(
indir
)
...
@@ -464,8 +470,19 @@ def test_imcp_script_shouldFail(move=False):
...
@@ -464,8 +470,19 @@ def test_imcp_script_shouldFail(move=False):
cmd
=
cmd
.
replace
(
'indir'
,
indir
).
replace
(
'outdir'
,
outdir
)
cmd
=
cmd
.
replace
(
'indir'
,
indir
).
replace
(
'outdir'
,
outdir
)
sp
.
call
(
cmd
.
split
())
sp
.
call
(
cmd
.
split
())
if
move
:
assert
immv_script
.
main
(
imcp_args
)
!=
0
print
(
'calling {} {}'
.
format
(
'immv'
if
move
else
'imcp'
,
else
:
assert
imcp_script
.
main
(
imcp_args
)
!=
0
' '
.
join
(
imcp_args
)))
print
(
'indir before: {}'
.
format
(
os
.
listdir
(
indir
)))
print
(
'out dir before: {}'
.
format
(
os
.
listdir
(
outdir
)))
if
move
:
result
=
immv_script
.
main
(
imcp_args
)
else
:
result
=
imcp_script
.
main
(
imcp_args
)
print
(
'indir after: {}'
.
format
(
os
.
listdir
(
indir
)))
print
(
'out dir after: {}'
.
format
(
os
.
listdir
(
outdir
)))
assert
result
!=
0
sp
.
call
(
'chmod u+rwx {}'
.
format
(
indir
)
.
split
())
sp
.
call
(
'chmod u+rwx {}'
.
format
(
indir
)
.
split
())
sp
.
call
(
'chmod u+rwx {}'
.
format
(
outdir
).
split
())
sp
.
call
(
'chmod u+rwx {}'
.
format
(
outdir
).
split
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment