diff --git a/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_temperature_manager.py b/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_temperature_manager.py index 1160c3e5489972d17cfa08e75d151d34a91df3c0..261cf8415f4013d4a2a035068cb9745f0c7f661c 100644 --- a/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_temperature_manager.py +++ b/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_temperature_manager.py @@ -9,7 +9,7 @@ from .base import AbstractTestBases from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy from tango._tango import DevState -from tango import DevFailed +from tango import DeviceProxy import time @@ -21,12 +21,7 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase): def setUp(self): """Intentionally recreate the device object in each test""" self.recv_proxy = self.setup_recv_proxy() - self.sdp_proxy = self.setup_sdp_proxy() - self.unb2_proxy = self.setup_unb2_proxy() - self.apsct_proxy = self.setup_apsct_proxy() - self.apspu_proxy = self.setup_apspu_proxy() super().setUp("STAT/TemperatureManager/1") - self.proxy.put_property({"Shutdown_Device_List": ["STAT/SDP/1", "STAT/UNB2/1", "STAT/RECV/1", "STAT/APSCT/1", "STAT/APSPU/1"]}) def tearDown(self): self.recv_proxy.stop_poll_attribute("HBAT_LED_on_RW") @@ -41,62 +36,15 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase): self.assertTrue(recv_proxy.is_attribute_polled(f"HBAT_LED_on_RW")) return recv_proxy - def setup_sdp_proxy(self): - sdp_proxy = TestDeviceProxy("STAT/SDP/1") - sdp_proxy.off() - sdp_proxy.warm_boot() - sdp_proxy.set_defaults() - return sdp_proxy - - def setup_unb2_proxy(self): - unb2_proxy = TestDeviceProxy("STAT/UNB2/1") - unb2_proxy.off() - unb2_proxy.warm_boot() - unb2_proxy.set_defaults() - return unb2_proxy - - def setup_apsct_proxy(self): - apsct_proxy = TestDeviceProxy("STAT/APSCT/1") - apsct_proxy.off() - apsct_proxy.warm_boot() - apsct_proxy.set_defaults() - return apsct_proxy - - def setup_apspu_proxy(self): - apspu_proxy = TestDeviceProxy("STAT/APSPU/1") - apspu_proxy.off() - apspu_proxy.warm_boot() - apspu_proxy.set_defaults() - return apspu_proxy - def test_alarm(self): self.proxy.off() self.proxy.initialise() self.proxy.on() - # Here we trigger our own change event by just using an RW attribute - self.recv_proxy.HBAT_LED_on_RW = [[False] * 32] * 96 - time.sleep(2) - - self.assertFalse(self.proxy.is_alarming_R) - - self.recv_proxy.HBAT_LED_on_RW = [[True] * 32] * 96 - time.sleep(2) - - # the TEMP_MANAGER_is_alarming_R should now be True, since it should have detected the temperature alarm. - self.assertTrue(self.proxy.is_alarming_R) - - def test_shutdown(self): - recv_proxy = self.setup_recv_proxy() - sdp_proxy = self.setup_sdp_proxy() - unb2_proxy = self.setup_unb2_proxy() - apsct_proxy = self.setup_apsct_proxy() - apspu_proxy = self.setup_apspu_proxy() - self.proxy.off() - self.proxy.initialise() - self.proxy.on() - - devices = [sdp_proxy, recv_proxy, unb2_proxy, apsct_proxy, apspu_proxy] + # Exclude other devices which raise a TimeoutError, since they wait for the attribute *_translator_busy_R to become False + # (set instead to True in this test environment) + self.proxy.put_property({"Shutdown_Device_List": ["STAT/SDP/1", "STAT/APSPU/1"]}) + devices = [DeviceProxy("STAT/SDP/1"), DeviceProxy("STAT/APSPU/1")] # make sure none of the devices are in the OFF or FAULT state. Any other state is fine for dev in devices: @@ -106,22 +54,24 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase): dev.off() dev.warm_boot() - # toggle the attribute to make sure we get a change event to True - recv_proxy.HBAT_LED_on_RW = [[False] * 32] * 96 - recv_proxy.HBAT_LED_on_RW = [[True] * 32] * 96 + # Here we trigger our own change event by just using an RW attribute + self.recv_proxy.HBAT_LED_on_RW = [[False] * 32] * 96 + time.sleep(2) - # sleeping here to make sure we've dealt with the above events + self.assertFalse(self.proxy.is_alarming_R) + + self.recv_proxy.HBAT_LED_on_RW = [[True] * 32] * 96 time.sleep(2) - # make sure all the devices are in the DISABLE state + # the TEMP_MANAGER_is_alarming_R should now be True, since it should have detected the temperature alarm. + self.assertTrue(self.proxy.is_alarming_R) + + # make sure all the hardware devices are in the DISABLE state for dev in devices: - if dev.name().lower() in ["stat/sdp/1","stat/apspu/1"]: - self.assertEqual(DevState.DISABLE, dev.state()) - else: - # Other device raise a TimeoutError since they wait for the attribute *_translator_busy_R to become False - # (set instead to True in this test environment) - self.assertRaises(DevFailed) + self.assertEqual(DevState.DISABLE, dev.state()) + +