fix(mo1_bragg): omit ACS scan settings from the device configuration
This commit is contained in:
@@ -136,15 +136,17 @@ def test_set_xtal(mock_bragg):
|
||||
assert dev.crystal.xtal_enum.get() == 1
|
||||
|
||||
|
||||
def test_read_configuration_uses_acs_cache_and_omits_status_pvs(mock_bragg):
|
||||
def test_read_configuration_never_touches_acs_and_omits_status_pvs(mock_bragg):
|
||||
"""The device server re-reads the full configuration whenever any auto-monitored
|
||||
signal updates; the ticking status PVs must not be part of it, and repeated
|
||||
config reads must not hit the ACS controller again while the cache is fresh."""
|
||||
signal updates; neither the ticking status PVs nor the ACS socket signals may be
|
||||
part of it, so no passive read path ever produces a GETVAR."""
|
||||
dev = mock_bragg
|
||||
config = dev.read_configuration()
|
||||
assert "bragg_scan_settings_s_scan_energy_lo" in config
|
||||
assert "bragg_scan_settings_s_scan_energy_hi" in config
|
||||
assert "bragg_scan_settings_s_scan_scantime" in config
|
||||
# ACS scan settings are omitted: config reads must not touch the socket at all
|
||||
assert "bragg_scan_settings_s_scan_energy_lo" not in config
|
||||
assert "bragg_scan_settings_s_scan_energy_hi" not in config
|
||||
assert "bragg_scan_settings_s_scan_scantime" not in config
|
||||
assert dev.controller.get_var.call_count == 0
|
||||
# live status/progress PVs are omitted from the configuration
|
||||
assert "bragg_status_heartbeat" not in config
|
||||
assert "bragg_scan_control_scan_msg" not in config
|
||||
@@ -153,15 +155,13 @@ def test_read_configuration_uses_acs_cache_and_omits_status_pvs(mock_bragg):
|
||||
assert "bragg_scan_control_scan_time_left" not in config
|
||||
assert "bragg_scan_control_scan_done" not in config
|
||||
|
||||
acs_reads = dev.controller.get_var.call_count
|
||||
dev.read_configuration()
|
||||
assert dev.controller.get_var.call_count == acs_reads # served from cache
|
||||
|
||||
# a config change drops the cache for exactly that signal
|
||||
# explicit reads still work, are cached, and refresh after a put
|
||||
assert dev.scan_settings.s_scan_energy_lo.get() == 0.0
|
||||
dev.scan_settings.s_scan_energy_lo.get()
|
||||
assert dev.controller.get_var.call_count == 1 # second read served from cache
|
||||
dev.scan_settings.s_scan_energy_lo.put(7000.0)
|
||||
dev.read_configuration()
|
||||
assert dev.controller.get_var.call_count == acs_reads + 1
|
||||
assert dev.scan_settings.s_scan_energy_lo.get() == 7000.0
|
||||
assert dev.controller.get_var.call_count == 2 # put dropped the cache
|
||||
|
||||
|
||||
def test_set_xas_settings(mock_bragg):
|
||||
|
||||
Reference in New Issue
Block a user