From ade3bcc558e11aea083564e9fa95718752deec71 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 8 Jan 2025 01:04:56 +0100 Subject: [PATCH 1/4] get_hash -> compute_hash --- aiida_test_cache/archive_cache/_fixtures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiida_test_cache/archive_cache/_fixtures.py b/aiida_test_cache/archive_cache/_fixtures.py index 6e6e7a3..9073a83 100644 --- a/aiida_test_cache/archive_cache/_fixtures.py +++ b/aiida_test_cache/archive_cache/_fixtures.py @@ -269,7 +269,7 @@ def mock_objects_to_hash_calcjob(self): if key not in self._hash_ignored_attributes and key not in self._updatable_attributes }, { - entry.link_label: entry.node.base.caching.get_hash() + entry.link_label: entry.node.base.caching.compute_hash() for entry in self.base.links.get_incoming( link_type=(LinkType.INPUT_CALC, LinkType.INPUT_WORK) ) if entry.link_label not in hash_ignored_inputs From 8d8332a5e531ed3ddb5fc07d9ab5403d48c6f442 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 8 Jan 2025 01:14:49 +0100 Subject: [PATCH 2/4] Patch in compute_hash for aiida-core <2.6 --- aiida_test_cache/archive_cache/_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aiida_test_cache/archive_cache/_utils.py b/aiida_test_cache/archive_cache/_utils.py index da23e14..a411e85 100644 --- a/aiida_test_cache/archive_cache/_utils.py +++ b/aiida_test_cache/archive_cache/_utils.py @@ -59,6 +59,14 @@ class MockNodeCaching(node_caching_class): #type: ignore def _get_objects_to_hash(self): return hash_objects_func(self) + # Compatibility with aiida-core < 2.6 + # https://github.com/aiidateam/aiida-core/pull/6347 + def compute_hash(self): + try: + return super().compute_hash() + except AttributeError: + return super().get_hash() + monkeypatch.setattr(node_class, "_CLS_NODE_CACHING", MockNodeCaching) From 1bc688ae0f598ada120d1a682945afefb0f5b3b5 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Mon, 2 Dec 2024 13:03:07 +0000 Subject: [PATCH 3/4] Relax aiida-core constraint --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6e29606..fcfbb6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ keywords = [ urls = {Homepage = "https://aiida-testing.readthedocs.io/"} requires-python = ">=3.9" dependencies = [ - "aiida-core>=2.1,<2.6", + "aiida-core>=2.1,<3", "pytest>=7.0", "voluptuous~=0.12", ] From 09b31c8b1b6561307988f5b6e550c83562f72103 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 8 Jan 2025 11:39:39 +0100 Subject: [PATCH 4/4] Monkeypatch get_objects_to_hash --- aiida_test_cache/archive_cache/_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aiida_test_cache/archive_cache/_utils.py b/aiida_test_cache/archive_cache/_utils.py index a411e85..22f3524 100644 --- a/aiida_test_cache/archive_cache/_utils.py +++ b/aiida_test_cache/archive_cache/_utils.py @@ -56,7 +56,12 @@ class MockNodeCaching(node_caching_class): #type: ignore NodeCaching subclass with stripped down _get_objects_to_hash method """ + # Compatibility with aiida-core < 2.6 + # In https://github.com/aiidateam/aiida-core/pull/6323 def _get_objects_to_hash(self): + return self.get_objects_to_hash() + + def get_objects_to_hash(self): return hash_objects_func(self) # Compatibility with aiida-core < 2.6