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
Christoph Arthofer
fslpy
Commits
0be88490
Commit
0be88490
authored
Apr 16, 2021
by
Paul McCarthy
🚵
Browse files
TEST: Remove use of six/backported mock
parent
95b43c48
Changes
10
Hide whitespace changes
Inline
Side-by-side
tests/__init__.py
View file @
0be88490
...
...
@@ -20,11 +20,9 @@ import os.path as op
import
numpy
as
np
import
nibabel
as
nib
from
six
import
StringIO
from
io
import
StringIO
try
:
from
unittest
import
mock
except
ImportError
:
import
mock
from
unittest
import
mock
import
fsl.data.image
as
fslimage
from
fsl.utils.tempdir
import
tempdir
...
...
tests/test_idle.py
View file @
0be88490
...
...
@@ -9,11 +9,10 @@ import gc
import
time
import
threading
import
random
from
six.moves
import
reload_module
import
importlib
import
pytest
import
mock
from
unittest
import
mock
import
fsl.utils.idle
as
idle
from
fsl.utils.platform
import
platform
as
fslplatform
...
...
@@ -428,7 +427,7 @@ def test_idle_alwaysQueue4():
with
pytest
.
raises
(
ImportError
):
import
wx
reload_module
(
fsl
.
utils
.
platform
)
importlib
.
reload
(
fsl
.
utils
.
platform
)
assert
called
[
0
]
...
...
tests/test_image.py
View file @
0be88490
...
...
@@ -32,11 +32,7 @@ from fsl.utils.tempdir import tempdir
from
.
import
make_random_image
from
.
import
make_dummy_file
try
:
from
unittest
import
mock
except
ImportError
:
import
mock
from
unittest
import
mock
try
:
import
indexed_gzip
as
igzip
...
...
tests/test_image_advanced.py
View file @
0be88490
...
...
@@ -7,8 +7,8 @@
import
os.path
as
op
import
time
from
unittest
import
mock
import
mock
import
pytest
import
numpy
as
np
...
...
tests/test_memoize.py
View file @
0be88490
...
...
@@ -6,7 +6,6 @@
#
import
collections
import
six
import
numpy
as
np
...
...
@@ -44,7 +43,7 @@ def test_memoize():
assert
timesCalled
[
0
]
==
6
# Unicode arg
s
=
six
.
u
(
'
\u25B2
'
)
s
=
'
\u25B2
'
assert
memoized
(
s
)
==
s
*
5
assert
timesCalled
[
0
]
==
7
assert
memoized
(
s
)
==
s
*
5
...
...
@@ -146,7 +145,7 @@ def test_memoizeMD5():
assert
timesCalled
[
0
]
==
6
# Unicode arg (and return value)
s
=
six
.
u
(
'
\u25B2
'
)
s
=
'
\u25B2
'
assert
memoized
(
s
)
==
s
*
5
assert
timesCalled
[
0
]
==
7
assert
memoized
(
s
)
==
s
*
5
...
...
tests/test_platform.py
View file @
0be88490
...
...
@@ -6,15 +6,14 @@
#
import
os
import
gc
import
os.path
as
op
import
sys
import
shutil
import
tempfile
import
pytest
import
mock
import
os
import
gc
import
os.path
as
op
import
sys
import
shutil
import
tempfile
import
pytest
from
unittest
import
mock
import
fsl.utils.platform
as
fslplatform
...
...
@@ -216,7 +215,7 @@ def test_detect_ssh():
def
test_fslwsl
():
"""
Note that ``Platform.fsldir`` requires the directory in ``FSLDIR`` to exist and
sets ``FSLDIR`` to ``None`` if it doesn't. So we create a ``Platform`` first
sets ``FSLDIR`` to ``None`` if it doesn't. So we create a ``Platform`` first
and then overwrite ``FSLDIR``. This is a bit of a hack but the logic we are testing
here is whether ``Platform.fslwsl`` recognizes a WSL ``FSLDIR`` string
"""
...
...
tests/test_run.py
View file @
0be88490
...
...
@@ -11,12 +11,8 @@ import os
import
shutil
import
textwrap
# python 3
try
:
from
unittest
import
mock
# python 2
except
ImportError
:
import
mock
from
unittest
import
mock
import
six
import
pytest
import
fsl.utils.tempdir
as
tempdir
...
...
@@ -273,7 +269,7 @@ def test_runfsl():
def
mock_submit
(
cmd
,
**
kwargs
):
if
isinstance
(
cmd
,
s
ix
.
string_types
):
if
isinstance
(
cmd
,
s
tr
):
name
=
cmd
.
split
()[
0
]
else
:
name
=
cmd
[
0
]
...
...
tests/test_settings.py
View file @
0be88490
...
...
@@ -12,12 +12,7 @@ import pickle
import
textwrap
import
tempfile
# python 3
try
:
import
unittest.mock
as
mock
# python 2
except
:
import
mock
import
unittest.mock
as
mock
import
pytest
...
...
tests/test_transform/test_affine.py
View file @
0be88490
...
...
@@ -6,8 +6,6 @@
#
from
__future__
import
division
import
random
import
glob
import
os.path
as
op
...
...
@@ -15,8 +13,6 @@ import itertools as it
import
numpy
as
np
import
numpy.linalg
as
npla
import
six
import
pytest
import
fsl.transform.affine
as
affine
...
...
@@ -39,8 +35,7 @@ def readlines(filename):
#
# Pass it [bytes, bytes, ...], and it works
# fine.
if
six
.
PY3
:
lines
=
[
l
.
encode
(
'ascii'
)
for
l
in
lines
]
lines
=
[
l
.
encode
(
'ascii'
)
for
l
in
lines
]
return
lines
...
...
tests/test_wrappers/test_wrapperutils.py
View file @
0be88490
...
...
@@ -11,10 +11,8 @@ import shlex
import
pathlib
import
textwrap
try
:
from
unittest
import
mock
except
ImportError
:
import
mock
from
unittest
import
mock
import
six
import
pytest
import
numpy
as
np
...
...
@@ -317,7 +315,7 @@ def test_fileOrThing_sequence():
@
wutils
.
fileOrArray
(
'arrs'
,
'out'
)
def
func
(
arrs
,
out
):
if
isinstance
(
arrs
,
s
ix
.
string_types
):
if
isinstance
(
arrs
,
s
tr
):
arrs
=
[
arrs
]
arrs
=
[
np
.
loadtxt
(
a
)
for
a
in
arrs
]
...
...
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