fix(bec_lib): exclude disabled devices in device filters

This commit is contained in:
wakonig_k 2024-02-26 19:21:58 +01:00
parent 3979a1e5e2
commit 388baae9f1
2 changed files with 7 additions and 1 deletions

View File

@ -115,7 +115,7 @@ class DeviceContainer(dict):
excluded_readout_priority = [ excluded_readout_priority = [
str(x.name).lower() for x in ReadoutPriority if x != readout_priority str(x.name).lower() for x in ReadoutPriority if x != readout_priority
] ]
excluded_devices = [] excluded_devices = self.disabled_devices
for priority in excluded_readout_priority: for priority in excluded_readout_priority:
excluded_devices.extend(self.get(dev) for dev in readout_priority_mod.get(priority, [])) excluded_devices.extend(self.get(dev) for dev in readout_priority_mod.get(priority, []))

View File

@ -318,3 +318,9 @@ def test_device_config_update_callback(dm_with_devices):
with mock.patch.object(dm, "parse_config_message") as parse_config_message: with mock.patch.object(dm, "parse_config_message") as parse_config_message:
dm._device_config_update_callback(msg, parent=dm) dm._device_config_update_callback(msg, parent=dm)
parse_config_message.assert_called_once_with(dev_config_msg) parse_config_message.assert_called_once_with(dev_config_msg)
def test_disabled_device_not_in_monitored(dm_with_devices):
assert "motor1_disabled" in dm_with_devices.devices
monitored_devices = dm_with_devices.devices.monitored_devices()
assert "motor1_disabled" not in [dev.name for dev in monitored_devices]