Skip to content

Commit

Permalink
Fixes tests with caching for KkrCalculation and VoronoiCalculation
Browse files Browse the repository at this point in the history
should work for aiida-core v2.5.2
  • Loading branch information
PhilippRue committed Nov 20, 2024
1 parent fb57239 commit 28662e0
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
aiida: [{version: 'aiida-core==2.2.2', name: '2.2.2'}]
aiida: [{version: 'aiida-core==2.5.2', name: '2.5.2'}]
masci-tools: [{version: 'git+https://github.com/JuDFTteam/masci-tools.git@develop', name: '-masci-develop'}]
allowed-to-fail: [false]

Expand Down
File renamed without changes.
22 changes: 12 additions & 10 deletions tests/calculations/test_kkrcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from aiida.engine import run, run_get_node
from ..dbsetup import *
from ..conftest import kkrhost_local_code, test_dir, data_dir, import_with_migration
from aiida_testing.export_cache._fixtures import run_with_cache, export_cache, load_cache, hash_code_by_entrypoint, absolute_archive_path
from aiida.manage.tests.pytest_fixtures import (
aiida_local_code_factory, aiida_localhost, temp_dir, aiida_profile, clear_database, clear_database_after_test,
clear_database_before_test
)
# from aiida_testing.export_cache._fixtures import run_with_cache, export_cache, load_cache, hash_code_by_entrypoint, absolute_archive_path
# from aiida.manage.tests.pytest_fixtures import (
# aiida_local_code_factory, aiida_localhost, temp_dir, aiida_profile, clear_database, clear_database_after_test,
# clear_database_before_test
# )

# some global settings
eps = 10**-14 # threshold for float comparison equivalence
Expand Down Expand Up @@ -54,7 +54,7 @@ def test_kkr_from_voronoi(self, kkrhost_local_code):
builder.metadata.dry_run = dry_run
out, node = run_get_node(builder)

def test_kkr_cached(self, aiida_profile, kkrhost_local_code, run_with_cache):
def test_kkr_cached(self, aiida_profile, kkrhost_local_code, enable_archive_cache):
"""
simple Cu noSOC, FP, lmax2 full example
"""
Expand Down Expand Up @@ -85,7 +85,8 @@ def test_kkr_cached(self, aiida_profile, kkrhost_local_code, run_with_cache):
print(kkrhost_local_code)
print(voro_calc)
print(builder)
out, node = run_with_cache(builder, data_dir=data_dir)
with enable_archive_cache(data_dir / 'kkr_cached.aiida'):
out, node = run_get_node(builder)
print((node, out))
print((node.get_cache_source()))
assert node.get_cache_source() is not None
Expand Down Expand Up @@ -187,7 +188,7 @@ def test_kkr_qdos(self, kkrhost_local_code):
out = run(builder)
print(out)

def test_kkr_increased_lmax(self, clear_database_before_test, kkrhost_local_code, run_with_cache):
def test_kkr_increased_lmax(self, clear_database_before_test, kkrhost_local_code, enable_archive_cache):
"""
run kkr calculation from output of previous calculation but with increased lmax
(done with auxiliary voronoi calculation which is imported here).
Expand Down Expand Up @@ -219,7 +220,8 @@ def test_kkr_increased_lmax(self, clear_database_before_test, kkrhost_local_code
builder.parent_folder = voro_with_kkr_input.outputs.remote_folder

# now run or load from cached data
out, node = run_with_cache(builder, data_dir=data_dir)
with enable_archive_cache(data_dir / 'kkr_increased_lmax.aiida'):
out, node = run_get_node(builder)
print('cache_source:', node.get_hash())
print('cache_source:', node.get_cache_source())
print('code objects to hash:', node._get_objects_to_hash())
Expand Down Expand Up @@ -252,7 +254,7 @@ def test_kkr_increased_lmax(self, clear_database_before_test, kkrhost_local_code
v = input_remote.get_incoming().first().node
assert 'parent_KKR' in [i.link_label for i in v.get_incoming()]

def test_kkr_gf_writeout_full_impcls(self, kkrhost_local_code, run_with_cache):
def test_kkr_gf_writeout_full_impcls(self, kkrhost_local_code):
"""
run kkr calculation from output of previous calculation but with increased lmax
(done with auxiliary voronoi calculation which is imported here).
Expand Down
2 changes: 1 addition & 1 deletion tests/calculations/test_vorocalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from builtins import object
import pytest
import pathlib
from aiida.manage.tests.pytest_fixtures import clear_database, clear_database_after_test, clear_database_before_test
# from aiida.manage.tests.pytest_fixtures import clear_database, clear_database_after_test, clear_database_before_test
# from aiida_testing.export_cache._fixtures import run_with_cache, export_cache, load_cache, hash_code_by_entrypoint, absolute_archive_path

# from aiida.tools.pytest_fixtures import *
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added tests/data_dir/kkr_cached.aiida
Binary file not shown.
Binary file added tests/data_dir/kkr_increased_lmax.aiida
Binary file not shown.
Binary file modified tests/data_dir/voronoi_after_kkr.aiida
Binary file not shown.
Binary file modified tests/data_dir/voronoi_cached.aiida
Binary file not shown.

0 comments on commit 28662e0

Please sign in to comment.