Skip to content

Commit

Permalink
special case of h5py<2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed Nov 23, 2022
1 parent f63ed2e commit 2fe2bf3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/hdf5plugin/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,15 @@ def register_filter(name):
# Unregister existing filter
filter_id = FILTERS[name]
is_avail = is_filter_available(name)
# TODO h5py>=2.10
if h5py.version.version_tuple < (2, 10) and is_avail in (True, None):
logger.error(
"h5py.h5z.unregister_filter is not available in this version of h5py.")
return False
if is_avail is True:
if not h5py.h5z.unregister_filter(filter_id):
logger.error("Failed to unregister filter %s (%d)" % (name, filter_id))
return False
elif is_avail is None: # Cannot probe filter availability
if is_avail is None: # Cannot probe filter availability
try:
h5py.h5z.unregister_filter(filter_id)
except RuntimeError:
Expand Down
2 changes: 2 additions & 0 deletions src/hdf5plugin/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def _simple_test(self, filter_name):
else:
self._test(filter_name)

@unittest.skipIf(h5py.version.version_tuple < (2, 10), "h5py<2.10: unregister_filer not available")
@unittest.skipUnless(hdf5plugin.config.embedded_filters, "No embedded filters")
def test_register_single_filter(self):
"""Re-register embedded filters one at a time"""
Expand All @@ -289,6 +290,7 @@ def test_register_single_filter(self):
self.assertTrue(status)
self._simple_test(filter_name)

@unittest.skipIf(h5py.version.version_tuple < (2, 10), "h5py<2.10: unregister_filer not available")
@unittest.skipUnless(hdf5plugin.config.embedded_filters, "No embedded filters")
def test_register_all_filters(self):
"""Re-register embedded filters all at once"""
Expand Down

0 comments on commit 2fe2bf3

Please sign in to comment.