Skip to content

Commit 16a0c8f

Browse files
committed
TEST: Drop BZ2 mio error checks (Python 3.3 only)
1 parent 34a7caf commit 16a0c8f

File tree

3 files changed

+2
-35
lines changed

3 files changed

+2
-35
lines changed

nibabel/tests/test_analyze.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,6 @@ class TestAnalyzeImage(tsi.TestSpatialImage, tsi.MmapImageMixin):
698698
image_class = AnalyzeImage
699699
can_save = True
700700
supported_np_types = TestAnalyzeHeader.supported_np_types
701-
# Flag to skip bz2 save tests if they are going to break
702-
bad_bz2 = False
703701

704702
def test_supported_types(self):
705703
img = self.image_class(np.zeros((2, 3, 4)), np.eye(4))
@@ -794,9 +792,7 @@ def test_big_offset_exts(self):
794792
arr = np.arange(24, dtype=np.int16).reshape((2, 3, 4))
795793
aff = np.eye(4)
796794
img_ext = img_klass.files_types[0][1]
797-
compressed_exts = ['', '.gz']
798-
if not self.bad_bz2:
799-
compressed_exts.append('.bz2')
795+
compressed_exts = ['', '.gz', '.bz2']
800796
with InTemporaryDirectory():
801797
for offset in (0, 2048):
802798
# Set offset in in-memory image

nibabel/tests/test_helpers.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,33 +31,6 @@ def bytesio_round_trip(img):
3131
return klass.from_file_map(bytes_map)
3232

3333

34-
def bz2_mio_error():
35-
""" Return True if writing mat 4 file fails
36-
37-
Writing an empty string can fail for bz2 objects in python 3.3:
38-
39-
https://bugs.python.org/issue16828
40-
41-
This in turn causes scipy to give this error when trying to write bz2 mat
42-
files.
43-
44-
This won't cause a problem for scipy releases after Jan 24 2014 because of
45-
commit 98ef522d99 (in scipy)
46-
"""
47-
if not have_scipy:
48-
return True
49-
import scipy.io
50-
51-
with InTemporaryDirectory():
52-
with ImageOpener('test.mat.bz2', 'wb') as fobj:
53-
try:
54-
scipy.io.savemat(fobj, {'a': 1}, format='4')
55-
except ValueError:
56-
return True
57-
else:
58-
return False
59-
60-
6134
def assert_data_similar(arr, params):
6235
""" Check data is the same if recorded, otherwise check summaries
6336

nibabel/tests/test_spm99analyze.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from ..testing import assert_allclose_safely, suppress_warnings
3232

3333
from . import test_analyze
34-
from .test_helpers import (bytesio_round_trip, bytesio_filemap, bz2_mio_error)
34+
from .test_helpers import bytesio_round_trip, bytesio_filemap
3535

3636
FLOAT_TYPES = np.sctypes['float']
3737
COMPLEX_TYPES = np.sctypes['complex']
@@ -404,8 +404,6 @@ def test_nan2zero_range_ok(self):
404404
class TestSpm99AnalyzeImage(test_analyze.TestAnalyzeImage, ImageScalingMixin):
405405
# class for testing images
406406
image_class = Spm99AnalyzeImage
407-
# Flag to skip bz2 save tests if they are going to break
408-
bad_bz2 = bz2_mio_error()
409407

410408
# Decorating the old way, before the team invented @
411409
test_data_hdr_cache = (scipy_skip(

0 commit comments

Comments
 (0)