Skip to content

Commit

Permalink
Bump minimum AiiDA version to 2.1
Browse files Browse the repository at this point in the history
v2.1.0 was released in 2022-11-07
so it should be fine to require it.
This let's us delete some special-case code
and drop dependency on setuptools.
  • Loading branch information
danielhollas committed Dec 7, 2024
1 parent 094bdb7 commit 2a53ad2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
19 changes: 4 additions & 15 deletions aiida_test_cache/mock_code/_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

import click
import pytest
from aiida import __version__ as aiida_version
from aiida.orm import Code
from pkg_resources import parse_version

from .._config import CONFIG_FILE_NAME, Config, ConfigActions
from ._env_keys import MockVariables
Expand Down Expand Up @@ -251,19 +249,10 @@ def _get_mock_code(
# Monkeypatch MPI behavior of code class, if requested either directly via `--mock-disable-mpi` or
# indirectly via `--mock-fail-on-missing` (no need to use MPI in this case)
if _disable_mpi or _fail_on_missing:
is_mpi_disable_supported = parse_version(aiida_version) >= parse_version('2.1.0')

if not is_mpi_disable_supported:
if _disable_mpi:
raise ValueError(
"Upgrade to AiiDA >= 2.1.0 in order to use `--mock-disable-mpi`"
)
# if only _fail_on_missing, we silently do not disable MPI
else:
monkeypatch.setattr(
code.__class__, 'get_prepend_cmdline_params',
_forget_mpi_decorator(code.__class__.get_prepend_cmdline_params)
)
monkeypatch.setattr(
code.__class__, 'get_prepend_cmdline_params',
_forget_mpi_decorator(code.__class__.get_prepend_cmdline_params)
)

return code

Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ keywords = [
]
urls = {Homepage = "https://aiida-testing.readthedocs.io/"}
requires-python = ">=3.9"
# Note the dependency on setuptools due to pkg_resources
dependencies = [
"aiida-core>=2.0,<2.6",
"aiida-core>=2.1,<2.6",
"pytest>=7.0",
"voluptuous~=0.12",
"setuptools",
]

[project.optional-dependencies]
Expand All @@ -60,7 +58,6 @@ tests = [
pre_commit = [
"pre-commit",
"mypy==1.13",
"types-setuptools==65.7.0.3",
"types-PyYAML",
]
dev = [
Expand Down
5 changes: 0 additions & 5 deletions tests/mock_code/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
from pathlib import Path

import pytest
from aiida import __version__ as aiida_version
from aiida.engine import run_get_node
from aiida.plugins import CalculationFactory
from pkg_resources import parse_version

CALC_ENTRY_POINT = 'diff'

Expand Down Expand Up @@ -211,9 +209,6 @@ def test_regenerate_test_data_executable(mock_code_factory, generate_diff_inputs
assert (datadir / 'file1.txt').is_file()


@pytest.mark.skipif(
parse_version(aiida_version) < parse_version('2.1.0'), reason='requires AiiDA v2.1.0+'
)
def test_disable_mpi(mock_code_factory, generate_diff_inputs):
"""
Check that disabling MPI is respected.
Expand Down

0 comments on commit 2a53ad2

Please sign in to comment.