From e4cbf1ef8c906c21e1395ff1ec3f29e990ba065d Mon Sep 17 00:00:00 2001 From: Hannes Feldt <feldt@astron.nl> Date: Tue, 18 Mar 2025 10:09:04 +0000 Subject: [PATCH] Fix integration tests --- .../power_hierarchy_tests.py | 1 + .../default/common/test_configuration.py | 1 - .../test_power_hierarchy.py | 1 + .../base_device_classes/test_proxy_timeout.py | 1 + .../devices/test_device_observation_field.py | 30 ++++++++++++++++--- .../devices/test_device_protection_control.py | 1 - .../test_digitalbeam_performance.py | 4 +-- .../test_tilebeam_performance.py | 4 +-- 8 files changed, 33 insertions(+), 10 deletions(-) diff --git a/integration_tests/common/base_device_classes/power_hierarchy_tests.py b/integration_tests/common/base_device_classes/power_hierarchy_tests.py index 56dc57134..55e2a48cb 100644 --- a/integration_tests/common/base_device_classes/power_hierarchy_tests.py +++ b/integration_tests/common/base_device_classes/power_hierarchy_tests.py @@ -4,6 +4,7 @@ """ Power Hierarchy module integration test """ + import logging from tango import DevState, DeviceProxy diff --git a/integration_tests/default/common/test_configuration.py b/integration_tests/default/common/test_configuration.py index 25cd09c7d..a98a74a25 100644 --- a/integration_tests/default/common/test_configuration.py +++ b/integration_tests/default/common/test_configuration.py @@ -11,7 +11,6 @@ from tangostationcontrol.common.configuration import StationConfiguration class TestStationConfiguration(BaseIntegrationTestCase): - TEST_CONFIGURATION = """{ "servers": { "AFH": { diff --git a/integration_tests/default/devices/base_device_classes/test_power_hierarchy.py b/integration_tests/default/devices/base_device_classes/test_power_hierarchy.py index e9d771fd8..4bcc656fc 100644 --- a/integration_tests/default/devices/base_device_classes/test_power_hierarchy.py +++ b/integration_tests/default/devices/base_device_classes/test_power_hierarchy.py @@ -4,6 +4,7 @@ """ Power Hierarchy module integration test """ + import logging import tangostationcontrol diff --git a/integration_tests/default/devices/base_device_classes/test_proxy_timeout.py b/integration_tests/default/devices/base_device_classes/test_proxy_timeout.py index a02b5c4c7..f86e9003b 100644 --- a/integration_tests/default/devices/base_device_classes/test_proxy_timeout.py +++ b/integration_tests/default/devices/base_device_classes/test_proxy_timeout.py @@ -4,6 +4,7 @@ """ Power Hierarchy module integration test """ + import logging from tango import Database diff --git a/integration_tests/default/devices/test_device_observation_field.py b/integration_tests/default/devices/test_device_observation_field.py index 69578eb8d..79ea931cb 100644 --- a/integration_tests/default/devices/test_device_observation_field.py +++ b/integration_tests/default/devices/test_device_observation_field.py @@ -1,4 +1,4 @@ -# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy) +# Copyright (C) 2025 ASTRON (Netherlands Institute for Radio Astronomy) # SPDX-License-Identifier: Apache-2.0 import json @@ -153,6 +153,28 @@ class TestDeviceObservationField(TestDeviceBase): } ) + def test_device_boot(self): + """Test if we can transition off -> on using a warm boot""" + self.proxy.observation_field_settings_RW = self.VALID_JSON + super().test_device_boot() + + def test_device_initialize(self): + """Test if we can transition to standby""" + self.proxy.observation_field_settings_RW = self.VALID_JSON + super().test_device_initialize() + + def test_device_on(self): + """Test if we can transition off -> standby -> on""" + self.proxy.observation_field_settings_RW = self.VALID_JSON + super().test_device_on() + + def test_device_read_all_attributes(self): + """Test if we can read all of the exposed attributes in the ON state. + + This test covers the reading logic of all attributes.""" + self.proxy.observation_field_settings_RW = self.VALID_JSON + super().test_device_read_all_attributes() + def test_init_valid(self): """Initialize an observation with valid JSON""" @@ -251,9 +273,9 @@ class TestDeviceObservationField(TestDeviceBase): self.proxy.observation_field_settings_RW = self.VALID_JSON self.proxy.Initialise() self.proxy.On() - expected_bands = [ - [2, 2] - ] * CS001_TILES # we request every antenna to be in this band, regardless of mask + expected_bands = ( + [[2, 2]] * CS001_TILES + ) # we request every antenna to be in this band, regardless of mask self.assertListEqual( antennafield_proxy.RCU_band_select_RW.tolist(), expected_bands ) diff --git a/integration_tests/default/devices/test_device_protection_control.py b/integration_tests/default/devices/test_device_protection_control.py index e4e832968..180b99a85 100644 --- a/integration_tests/default/devices/test_device_protection_control.py +++ b/integration_tests/default/devices/test_device_protection_control.py @@ -86,7 +86,6 @@ class TestDeviceProtectionControl(TestDeviceBase): @pytest.mark.timeout(10) def test_change_events_received(self): - self.proxy.boot() self.assertEqual(self.proxy.state(), DevState.ON) diff --git a/integration_tests/digitalbeam_performance/test_digitalbeam_performance.py b/integration_tests/digitalbeam_performance/test_digitalbeam_performance.py index ea8059b70..dd86157e4 100644 --- a/integration_tests/digitalbeam_performance/test_digitalbeam_performance.py +++ b/integration_tests/digitalbeam_performance/test_digitalbeam_performance.py @@ -137,8 +137,8 @@ class TestDigitalbeamPerformance(base.IntegrationTestCase): self.assertEqual(0, beam.Nr_update_pointing_exceptions_R) logging.error( - f"Median {statistics.median(results) / 1.e9} Stdev " - f"{statistics.stdev(results) / 1.e9}" + f"Median {statistics.median(results) / 1.0e9} Stdev " + f"{statistics.stdev(results) / 1.0e9}" ) def test_digitalbeam_multi_tracking_performance(self): diff --git a/integration_tests/tilebeam_performance/test_tilebeam_performance.py b/integration_tests/tilebeam_performance/test_tilebeam_performance.py index 406e632eb..7e755a2a5 100644 --- a/integration_tests/tilebeam_performance/test_tilebeam_performance.py +++ b/integration_tests/tilebeam_performance/test_tilebeam_performance.py @@ -75,7 +75,7 @@ class TestTilebeamPerformance(base.IntegrationTestCase): # Beam / Recv [HBA0, HBA1, HBA2, HBA3] for i, item in enumerate(hba_devices): - recv_proxies.append(TestDeviceProxy(f"STAT/RECVH/{i+1}")) + recv_proxies.append(TestDeviceProxy(f"STAT/RECVH/{i + 1}")) antenna_field_proxies.append(TestDeviceProxy(f"STAT/AFH/{item}")) beam_proxies.append(TestDeviceProxy(f"STAT/TileBeam/{item}")) @@ -99,7 +99,7 @@ class TestTilebeamPerformance(base.IntegrationTestCase): "Control_Children": [ "STAT/SDPFirmware/HBA0", f"STAT/RECVH/{n}", - f"STAT/tilebeam/HBA{n-1}", + f"STAT/tilebeam/HBA{n - 1}", ], "Control_to_RECV_mapping": numpy.array(control_mapping).flatten(), "Antenna_Status": antenna_status, -- GitLab