From 5fb395e13eb9c488b867a33bcc18f4bc14951ffe Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Wed, 8 Jul 2026 13:48:20 +0200 Subject: [PATCH] Fix #26: Switch to repackaged test fixtures --- tests/conftest.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index d9f08a4..c860c01 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,7 @@ import aiida_dftk.calculations -pytest_plugins = 'aiida.manage.tests.pytest_fixtures' +pytest_plugins = 'aiida.tools.pytest_fixtures' _LOGGER = logging.getLogger(__name__) _julia_project_path = Path(__file__).parent / "julia_environment" @@ -28,14 +28,14 @@ def pytest_sessionstart(): @pytest.fixture -def get_dftk_code(aiida_local_code_factory): +def get_dftk_code(aiida_code_installed): """Return an ``InstalledCode`` instance configured to run DFTK calculations on localhost.""" def _get_code(): - return aiida_local_code_factory( - 'dftk', - 'julia', + return aiida_code_installed( label='dftk', + default_calc_job_plugin='dftk', + filepath_executable='julia', prepend_text=f"""\ export JULIA_PROJECT="{_julia_project_path}" """, @@ -117,6 +117,15 @@ def _load_psp(element: str): return _load_psp +# Override the default aiida_profile fixture to use a rabbitmq profile +# so we can submit workchains and wait for them to complete. +# Not ideal but whatever... +@pytest.fixture(scope="session", autouse=True) +def aiida_profile(aiida_config, aiida_profile_factory): + with aiida_profile_factory(aiida_config, broker_backend="core.rabbitmq") as profile: + yield profile + + # TODO: Something like this should exist in aiida! We shouldn't have to do it ourselves just to capture why the test failed. @pytest.fixture def submit_and_await_success(submit_and_await):