Skip to content

Commit

Permalink
Fix plugin tests for newer h5py.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyo-masui committed May 7, 2019
1 parent 70ffdc7 commit 81bcb6c
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions bitshuffle/tests/test_h5plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,14 @@ def test_plugins(self):
data = np.arange(shape[0])
fname = "tmp_test_filters.h5"
f = h5py.File(fname)
tid = h5t.py_create(dtype, logical=1)
sid = h5s.create_simple(shape, shape)
# Different API's for different h5py versions.
try:
dcpl = filters.generate_dcpl(shape, dtype, chunks, None, None,
None, None, None, None)
except TypeError:
dcpl = filters.generate_dcpl(shape, dtype, chunks, None, None,
None, None, None)
dcpl.set_filter(32008, h5z.FLAG_MANDATORY)
dcpl.set_filter(32000, h5z.FLAG_MANDATORY)
dset_id = h5d.create(f.id, b"range", tid, sid, dcpl=dcpl)
dset_id.write(h5s.ALL, h5s.ALL, data)
f = h5py.File(fname)
dset = f.create_dataset("range",
shape=shape,
dtype=dtype,
chunks=chunks,
compression=32008,
)
dset[:] = data
f.close()

# Make sure the filters are working outside of h5py by calling h5dump
Expand All @@ -63,16 +58,6 @@ def test_plugins(self):
self.assertTrue(np.all(d == data))
f.close()


#def test_h5py_hl(self):
# if not H51811P:
# return
# # Does not appear to be supported by h5py.
# fname = "tmp_test_h5py_hl.h5"
# f = h5py.File(fname)
# f.create_dataset("range", np.arange(1024, dtype=np.int64),
# compression=32008)

def tearDown(self):
files = glob.glob("tmp_test_*")
for f in files:
Expand Down

0 comments on commit 81bcb6c

Please sign in to comment.