fix: tie h5proxy config to properties

This commit is contained in:
perl_d 2025-01-27 18:16:05 +01:00
parent 7abd21233f
commit 8fd17c53d7
2 changed files with 19 additions and 0 deletions

View File

@ -39,6 +39,7 @@ class H5ImageReplayProxy(DeviceProxy):
@file_source.setter
def file_source(self, file_source: str) -> None:
self.config[list(self.config.keys())[0]]["file_source"] = file_source
self._file_source = file_source
@property
@ -48,6 +49,7 @@ class H5ImageReplayProxy(DeviceProxy):
@h5_entry.setter
def h5_entry(self, h5_entry: str) -> None:
self.config[list(self.config.keys())[0]]["h5_entry"] = h5_entry
self._h5_entry = h5_entry
def _update_device_config(self, config: dict) -> None:

View File

@ -453,6 +453,23 @@ def test_slitproxy(slitproxy_fixture):
assert (img[:, edges[1] :] == 0).all()
def test_proxy_config_and_props_stay_in_sync(h5proxy_fixture: tuple[H5ImageReplayProxy, SimCamera]):
h5proxy, cam = h5proxy_fixture
h5proxy._update_device_config(
{
cam.name: {
"signal_name": "image",
"file_source": "test first thing",
"h5_entry": "/entry/data/data",
}
}
)
h5proxy.file_source = "test different thing"
assert h5proxy.config[cam.name]["file_source"] == h5proxy.file_source
h5proxy.h5_entry = "/entry/data/data_000001"
assert h5proxy.config[cam.name]["h5_entry"] == h5proxy.h5_entry
def test_cam_stage_h5writer(camera):
"""Test the H5Writer class"""
with (