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

Check for atomate2 before running MP tests #2278

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion src/quacc/wflow_tools/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def wrapper(*f_args, **f_kwargs):
return _func(*f_args, **f_kwargs)

return Delayed_(delayed(wrapper, **kwargs))

elif SETTINGS.WORKFLOW_ENGINE == "jobflow":
from jobflow import job as jf_job

Expand Down
14 changes: 14 additions & 0 deletions tests/core/recipes/vasp_recipes/mocked/test_vasp_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
) # this works locally on Windows, but no clue why it fails on GitHub Actions

import logging
from importlib import util
from pathlib import Path

import numpy as np
Expand Down Expand Up @@ -38,6 +39,8 @@
from quacc.recipes.vasp.slabs import relax_job as slab_relax_job
from quacc.recipes.vasp.slabs import static_job as slab_static_job

has_atomate2 = util.find_spec("atomate2") is not None

FILE_DIR = Path(__file__).parent
MOCKED_DIR = FILE_DIR / "mocked_vasp_runs"
LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -450,6 +453,7 @@ def test_qmof(patch_nonmetallic_taskdoc):
assert output["double_relax"][1]["parameters"]["isif"] == 2


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_metagga_prerelax_job_metallic(patch_metallic_taskdoc):
atoms = bulk("Al")
output = mp_metagga_prerelax_job(atoms)
Expand Down Expand Up @@ -496,6 +500,7 @@ def test_mp_metagga_prerelax_job_metallic(patch_metallic_taskdoc):
assert "metagga" not in output["parameters"]


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_metagga_prerelax_job_nonmetallic(patch_nonmetallic_taskdoc):
atoms = bulk("Si")
output = mp_metagga_prerelax_job(atoms, prev_dir=MOCKED_DIR / "nonmetallic")
Expand All @@ -510,6 +515,7 @@ def test_mp_metagga_prerelax_job_nonmetallic(patch_nonmetallic_taskdoc):
assert "metagga" not in output["parameters"]


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_metagga_relax_job_metallic(patch_metallic_taskdoc):
atoms = bulk("Al")
ref_parameters = {
Expand Down Expand Up @@ -559,6 +565,7 @@ def test_mp_metagga_relax_job_metallic(patch_metallic_taskdoc):
assert output["parameters"]["pp"] == "pbe"


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_metagga_relax_job_nonmetallic(patch_nonmetallic_taskdoc):
atoms = bulk("Si")
output = mp_metagga_relax_job(atoms, prev_dir=MOCKED_DIR / "nonmetallic")
Expand All @@ -572,6 +579,7 @@ def test_mp_metagga_relax_job_nonmetallic(patch_nonmetallic_taskdoc):
assert output["parameters"]["pp"] == "pbe"


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_metagga_static_job(patch_metallic_taskdoc):
atoms = bulk("Al")

Expand Down Expand Up @@ -605,6 +613,7 @@ def test_mp_metagga_static_job(patch_metallic_taskdoc):
}


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_metagga_relax_flow_metallic(tmp_path, patch_metallic_taskdoc):
with change_settings({"CREATE_UNIQUE_DIR": False, "RESULTS_DIR": tmp_path}):
copy_r(MOCKED_DIR / "metallic", tmp_path)
Expand All @@ -626,6 +635,7 @@ def test_mp_metagga_relax_flow_metallic(tmp_path, patch_metallic_taskdoc):
assert output["relax2"]["parameters"]["pp"] == "pbe"


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_metagga_relax_flow_nonmetallic(tmp_path, patch_nonmetallic_taskdoc):
with change_settings({"CREATE_UNIQUE_DIR": False, "RESULTS_DIR": tmp_path}):
copy_r(MOCKED_DIR / "nonmetallic", tmp_path)
Expand Down Expand Up @@ -672,6 +682,7 @@ def test_mp_metagga_relax_flow_nonmetallic(tmp_path, patch_nonmetallic_taskdoc):
assert output["static"]["parameters"]["magmom"] == [0.0, 0.0]


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_gga_relax_job(patch_nonmetallic_taskdoc):
atoms = bulk("Ni") * (2, 1, 1)
atoms[0].symbol = "O"
Expand Down Expand Up @@ -712,6 +723,7 @@ def test_mp_gga_relax_job(patch_nonmetallic_taskdoc):
assert output["atoms"].get_chemical_symbols() == ["O", "Ni"]


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_gga_static_job(patch_nonmetallic_taskdoc):
atoms = bulk("Ni") * (2, 1, 1)
atoms[0].symbol = "O"
Expand Down Expand Up @@ -748,6 +760,7 @@ def test_mp_gga_static_job(patch_nonmetallic_taskdoc):
}


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_gga_relax_flow(tmp_path, patch_nonmetallic_taskdoc):
with change_settings({"CREATE_UNIQUE_DIR": False, "RESULTS_DIR": tmp_path}):
copy_r(MOCKED_DIR / "nonmetallic", tmp_path)
Expand Down Expand Up @@ -821,6 +834,7 @@ def test_mp_gga_relax_flow(tmp_path, patch_nonmetallic_taskdoc):
}


@pytest.mark.skipif(not has_atomate2, reason="atomate2 not installed")
def test_mp_relax_flow_custom(tmp_path, patch_nonmetallic_taskdoc):
with change_settings({"CREATE_UNIQUE_DIR": False, "RESULTS_DIR": tmp_path}):
copy_r(MOCKED_DIR / "nonmetallic", tmp_path)
Expand Down
Loading