Files
csaxs_bec/tests/e2e/conftest.py
T
Mirko HollerandClaude Sonnet 5 ff50711dc9 test(flomni): add tomo-queue e2e harness against the simulated flOMNI
Sections A-C of TOMO_QUEUE_TESTING.md's checklist, run against a live sim
session: params-restored-per-job, legacy queue migration, empty/all-done
no-ops, start_index semantics, exception/SIGKILL crash-resume, resume-
before-fresh ordering, and concurrent queue edits from a second client.
All 10 tests pass together with no cross-test interference.

The flomni_sim fixture and _bootstrap.py factor out what it takes to
construct a live Flomni against the sim (builtins/reload bootstrap,
side-effect neutralization, RT-feedback/fsamx setup) for reuse by both
in-process tests and the SIGKILL-based subprocess tests.

Also adds the AI_docs/ handoff docs (testing checklist results, command-
jobs plan with the action-registry decisions) that this work updated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-12 23:25:33 +02:00

38 lines
1.4 KiB
Python

"""Fixtures for end-to-end tomo-queue tests against a running flOMNI sim.
Deliberately does NOT use the shipped ``bec_client_lib_with_demo_config`` /
``bec_ipython_client_with_demo_config`` fixtures from pytest_bec_e2e: both
call ``bec.config.load_demo_config(force=True)``, which against a running sim
session overwrites the loaded simulated-flOMNI device config with BEC's demo
devices. See TOMO_QUEUE_TESTING.md section 3.
"""
import pytest
from _bootstrap import build_flomni, shutdown
_QUEUE_VAR = "tomo_queue"
_PROGRESS_VAR = "tomo_progress"
@pytest.fixture
def flomni_sim(bec_redis_fixture, bec_services_config_file_path, bec_servers):
"""A live ``Flomni`` instance attached to the already-running sim session.
See ``_bootstrap.build_flomni()`` for what connecting/constructing this
involves and why. The ``tomo_queue`` / ``tomo_progress`` global vars are
snapshotted before the test and restored after, so tests don't leak
queue/progress state into each other or into a real operator's session
on the same sim.
"""
bec, flomni = build_flomni(bec_services_config_file_path)
queue_snapshot = bec.get_global_var(_QUEUE_VAR)
progress_snapshot = bec.get_global_var(_PROGRESS_VAR)
try:
yield flomni
finally:
bec.set_global_var(_QUEUE_VAR, queue_snapshot)
bec.set_global_var(_PROGRESS_VAR, progress_snapshot)
shutdown(bec)