diff --git a/requirements.txt b/requirements.txt index 8dde3769f..37148add2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ # pinned dependencies to reproduce an entire development environment to use HDMF -h5py==3.8.0 -importlib-resources==5.12.0; python_version < "3.9" # TODO: remove when when minimum python version is 3.9 -jsonschema==4.17.3 -numpy==1.24.3 -pandas==2.0.1 -ruamel.yaml==0.17.24 -scipy==1.10.1 +h5py==3.9.0 +importlib-resources==6.0.0; python_version < "3.9" # TODO: remove when minimum python version is 3.9 +jsonschema==4.18.4 +numpy==1.25.1 +pandas==2.0.3 +ruamel.yaml==0.17.32 +scipy==1.11.1 diff --git a/src/hdmf/container.py b/src/hdmf/container.py index dc93ff95d..87f721dbf 100644 --- a/src/hdmf/container.py +++ b/src/hdmf/container.py @@ -194,8 +194,11 @@ def __gather_fields(cls, name, bases, classdict): def __del__(self): # Make sure the reference counter for our read IO is being decremented - del self.__read_io - self.__read_io = None + try: + del self.__read_io + self.__read_io = None + except AttributeError: + pass def __new__(cls, *args, **kwargs): """ diff --git a/tests/unit/test_container.py b/tests/unit/test_container.py index 4027ecb4e..feb85a907 100644 --- a/tests/unit/test_container.py +++ b/tests/unit/test_container.py @@ -131,6 +131,13 @@ def test_get_read_io_on_parent(self): self.assertIsNone(child_obj.read_io) self.assertIs(child_obj.get_read_io(), temp_io) + def test_del_read_io(self): + class TestContainer(AbstractContainer): + def __init__(self): + raise ValueError("Error") + with self.assertRaises(ValueError): + TestContainer() + def test_set_parent(self): """Test that parent setter properly sets parent """