Skip to content
Snippets Groups Projects
Commit 2e9d6ab7 authored by Corné Lukken's avatar Corné Lukken
Browse files

Merge branch 'fix-attribute-name-collision' into 'master'

L2SS-1993: Rename state of protection control to prevent collision

See merge request !982
parents b6512272 c0abb780
No related branches found
No related tags found
1 merge request!982L2SS-1993: Rename state of protection control to prevent collision
...@@ -151,6 +151,7 @@ Next change the version in the following places: ...@@ -151,6 +151,7 @@ Next change the version in the following places:
# Release Notes # Release Notes
* 0.42.7 Prevent Prometheus name collision in ProtectionControl state attribute
* 0.42.6 Fix crash caused by emitting change events for attributes polled by Tango * 0.42.6 Fix crash caused by emitting change events for attributes polled by Tango
* 0.42.5 Add additional features to protection control * 0.42.5 Add additional features to protection control
* 0.42.4 Add integration test fixture that routinely tests against cross test dependencies * 0.42.4 Add integration test fixture that routinely tests against cross test dependencies
......
0.42.6 0.42.7
...@@ -126,12 +126,12 @@ class ProtectionControl(LOFARDevice): ...@@ -126,12 +126,12 @@ class ProtectionControl(LOFARDevice):
# Attributes # Attributes
# ---------- # ----------
@attribute(dtype=ProtectionStateEnum, fisallowed="is_attribute_access_allowed") @attribute(dtype=ProtectionStateEnum)
def state_R(self): def protection_state_R(self):
if self._protection_manager: if self._protection_manager:
return self._protection_manager.state return int(self._protection_manager.state)
else: else:
return ProtectionStateEnum.DEACTIVATED return int(ProtectionStateEnum.DEACTIVATED)
@attribute( @attribute(
doc="Whether the station is periodically evaluated against damage", doc="Whether the station is periodically evaluated against damage",
...@@ -194,7 +194,7 @@ class ProtectionControl(LOFARDevice): ...@@ -194,7 +194,7 @@ class ProtectionControl(LOFARDevice):
"this value can be extremely stale!", "this value can be extremely stale!",
dtype=str, dtype=str,
) )
def last_threshold_device_attribute(self): def last_threshold_device_attribute_R(self):
return self._metrics.threshold_device_attribute return self._metrics.threshold_device_attribute
# -------- # --------
......
...@@ -9,6 +9,7 @@ from tango.test_context import DeviceTestContext ...@@ -9,6 +9,7 @@ from tango.test_context import DeviceTestContext
from tangostationcontrol.common.constants import DEFAULT_POLLING_PERIOD_MS from tangostationcontrol.common.constants import DEFAULT_POLLING_PERIOD_MS
from tangostationcontrol.devices import protection_control from tangostationcontrol.devices import protection_control
from tangostationcontrol.protection.state import ProtectionStateEnum
from test.devices import device_base from test.devices import device_base
...@@ -35,6 +36,21 @@ class TestProtectionControlDevice(device_base.DeviceTestCase): ...@@ -35,6 +36,21 @@ class TestProtectionControlDevice(device_base.DeviceTestCase):
self.assertTrue(proxy.protection_monitor_thread_running_R) self.assertTrue(proxy.protection_monitor_thread_running_R)
def test_protection_control_state(self, _database):
with DeviceTestContext(
protection_control.ProtectionControl,
process=False,
timeout=10,
) as proxy:
self.assertEqual(ProtectionStateEnum.DEACTIVATED, proxy.protection_state_R)
proxy.initialise()
proxy.on()
self.assertEqual(ProtectionStateEnum.OFF, proxy.protection_state_R)
def test_periodic_reattempt(self, _database): def test_periodic_reattempt(self, _database):
with DeviceTestContext( with DeviceTestContext(
protection_control.ProtectionControl, protection_control.ProtectionControl,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment