From bc500d0e07511aa35e9bdc9579b230144668f3e5 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Fri, 17 Jul 2026 14:45:24 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A7=AA=20Tests:=20add=20ZeroMQ=20brok?= =?UTF-8?q?er=20plugin=20support=20and=20run=20both=20brokers=20in=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Override the `aiida_profile` fixture to select the message broker backend via a new `--broker-backend` pytest option (`rmq` default, or `zmq`). ZeroMQ (`core.zeromq`) requires no external service, unlike RabbitMQ. Add a `broker: ['rmq', 'zmq']` matrix dimension to the `tests` jobs in `ci.yml` and `nightly.yml` so both backends are exercised, with `fail-fast: false` so each backend is reported independently. --- .github/workflows/ci.yml | 3 ++- .github/workflows/nightly.yml | 3 ++- tests/conftest.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dce17ad7b..8d11e1da6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,7 @@ jobs: strategy: matrix: python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] + broker: ['rmq', 'zmq'] services: postgres: @@ -55,4 +56,4 @@ jobs: - name: Run pytest env: AIIDA_WARN_v3: 1 - run: hatch test -v -- -s + run: hatch test -v -- -s --broker-backend ${{ matrix.broker }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index da42e7fd9..8243f7479 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -24,6 +24,7 @@ jobs: strategy: matrix: python-version: ['3.10', '3.14'] + broker: ['rmq', 'zmq'] services: postgres: @@ -51,7 +52,7 @@ jobs: id: tests env: AIIDA_WARN_v3: 1 - run: pytest -sv tests + run: pytest -sv tests --broker-backend ${{ matrix.broker }} - name: Slack notification if: always() && (steps.install.outcome == 'failure' || steps.tests.outcome == 'failure') && env.SLACK_WEBHOOK != null diff --git a/tests/conftest.py b/tests/conftest.py index ca12e07f6..2bd303977 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,6 +6,7 @@ import pathlib import shutil import tempfile +import time from collections.abc import Mapping from pathlib import Path @@ -13,6 +14,39 @@ pytest_plugins = ['aiida.tools.pytest_fixtures'] +BROKER_BACKENDS = { + 'rmq': 'core.rabbitmq', + 'zmq': 'core.zeromq', +} + + +def pytest_addoption(parser): + """Register the ``--broker-backend`` option to select the message broker used by the test profile.""" + parser.addoption( + '--broker-backend', + action='store', + default='rmq', + choices=tuple(BROKER_BACKENDS), + help='Broker backend for the test profile: `rmq` (RabbitMQ, default) or `zmq` (ZeroMQ).', + ) + +@pytest.fixture(scope='session', autouse=True) +def aiida_profile(pytestconfig, aiida_config, aiida_profile_factory, run_aiida_broker_service_for_profile): + """Load a temporary profile whose broker backend is selected through the ``--broker-backend`` option. + + This overrides the ``aiida_profile`` fixture provided by ``aiida-core``, which loads a profile without any broker. + The broker backend defaults to RabbitMQ (``core.rabbitmq``) and can be switched to ZeroMQ (``core.zeromq``), which + requires no external service, via the ``--broker-backend`` command line option. + + Several tests build an in-process runner that requires a communicator connected to the broker. Unlike RabbitMQ, + the ZeroMQ broker is not an external service but is launched by the daemon (through ``circus``). The daemon is + therefore started for the duration of the session when the ZeroMQ backend is selected, so that the broker is + available to the in-process runner, and stopped again at the end. + """ + broker_backend = BROKER_BACKENDS[pytestconfig.getoption('--broker-backend')] + + with aiida_profile_factory(aiida_config, broker_backend=broker_backend) as profile: + yield profile @pytest.fixture(scope='session', autouse=True) def clean_asyncio_tasks(): From a2b46552d36b51df061d92f2a0c4117951f530aa Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Thu, 23 Jul 2026 15:52:51 +0200 Subject: [PATCH 2/2] fix/datetime-serialize --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 8243f7479..ea30d9503 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -46,7 +46,7 @@ jobs: - name: Install Python dependencies (with aiida-core@main) id: install run: | - uv pip install -e .[tests] aiida-core[atomic_tools]@git+https://github.com/aiidateam/aiida-core@main + uv pip install -e .[tests] aiida-core[atomic_tools]@git+https://github.com/agoscinski/aiida-core@fix/datetime-serialize - name: Run pytest id: tests