Files
csaxs_bec/tests/tests_devices/test_omny_shutter.py
x01dcandClaude Sonnet 5 2086c9e4e6
CI for csaxs_bec / test (push) Successful in 1m48s
fix(omny): always route fast-shutter control through dev.fsh; carry owner/status/account across sample transfer
- shutter.py (OMNYFastShutter): drop the "use dev.fsh if configured, else
  fall back to a local dummy signal" branching -- always delegate to the
  'fsh' device. Removed the now-unused MonitorSignal class and the
  dummy shutter Cpt along with it. Rewrote test_omny_shutter.py to assert
  delegation to a mocked 'fsh' device instead of exercising the removed
  dummy fallback.
- omny_sample_transfer_mixin.py: picking a sample up (get_sample, three
  source kinds: shuttle slot, fixed position, sample stage) only carried
  the sample name into set_sample_in_gripper(), silently dropping owner
  (defaulted to "") and measured status/account (reset to "none" by
  set_sample_in_gripper() itself). Same gap in reverse on put_sample.
  All six call sites (three pick, three put) now read owner/status/account
  from the source before clearing it and carry them onto the destination.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Mupip8x7Hean6E3FFvpbj
2026-09-04 16:51:21 +02:00

52 lines
1.4 KiB
Python

from unittest import mock
import pytest
from bec_server.device_server.tests.utils import DMMock
from csaxs_bec.devices.omny.shutter import OMNYFastShutter
@pytest.fixture
def omny_fast_shutter():
device_manager = DMMock()
fsh = mock.MagicMock()
device_manager.devices["fsh"] = fsh
shutter = OMNYFastShutter(name="omny_fast_shutter", device_manager=device_manager)
try:
yield shutter, fsh
finally:
shutter.destroy()
def test_omny_fast_shutter_fshopen_delegates_to_fsh(omny_fast_shutter):
shutter, fsh = omny_fast_shutter
shutter.fshopen()
fsh.fshopen.assert_called_once()
def test_omny_fast_shutter_fshclose_delegates_to_fsh(omny_fast_shutter):
shutter, fsh = omny_fast_shutter
shutter.fshclose()
fsh.fshclose.assert_called_once()
def test_omny_fast_shutter_fshstatus_delegates_to_fsh(omny_fast_shutter):
shutter, fsh = omny_fast_shutter
fsh.fshstatus.return_value = 1
assert shutter.fshstatus() == 1
fsh.fshstatus.assert_called_once()
def test_omny_fast_shutter_fshstatus_readback_delegates_to_fsh(omny_fast_shutter):
shutter, fsh = omny_fast_shutter
fsh.fshstatus_readback.return_value = 0
assert shutter.fshstatus_readback() == 0
fsh.fshstatus_readback.assert_called_once()
def test_omny_fast_shutter_fshinfo_delegates_to_fsh(omny_fast_shutter):
shutter, fsh = omny_fast_shutter
shutter.fshinfo()
fsh.fshinfo.assert_called_once()