Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rmv warning from load_namespaces #926

Merged
merged 5 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/hdmf/backends/hdf5/h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,7 @@ def __load_namespaces(cls, namespace_catalog, namespaces, file_obj):

@classmethod
def __check_specloc(cls, file_obj):
if SPEC_LOC_ATTR not in file_obj.attrs:
# this occurs in legacy files
msg = "No cached namespaces found in %s" % file_obj.filename
warnings.warn(msg)
return False
return True
return SPEC_LOC_ATTR in file_obj.attrs

@classmethod
@docval({'name': 'path', 'type': (str, Path), 'doc': 'the path to the HDF5 file', 'default': None},
Expand Down
8 changes: 2 additions & 6 deletions tests/unit/test_io_hdf5_h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2159,9 +2159,7 @@ def test_load_namespaces_no_specloc(self):

# load the namespace from file
ns_catalog = NamespaceCatalog()
msg = "No cached namespaces found in %s" % self.path
with self.assertWarnsWith(UserWarning, msg):
ret = HDF5IO.load_namespaces(ns_catalog, self.path)
ret = HDF5IO.load_namespaces(ns_catalog, self.path)
self.assertDictEqual(ret, {})

def test_load_namespaces_resolve_custom_deps(self):
Expand Down Expand Up @@ -2375,9 +2373,7 @@ def test_get_namespaces_no_specloc(self):
del f.attrs[SPEC_LOC_ATTR]

# load the namespace from file
msg = "No cached namespaces found in %s" % self.path
with self.assertWarnsWith(UserWarning, msg):
ret = HDF5IO.get_namespaces(path=self.path)
ret = HDF5IO.get_namespaces(path=self.path)
self.assertDictEqual(ret, {})


Expand Down