diff --git a/common_tests/eurotherm.py b/common_tests/eurotherm.py index a3a3f200..d5037199 100644 --- a/common_tests/eurotherm.py +++ b/common_tests/eurotherm.py @@ -1,11 +1,15 @@ import abc import os import time +import typing +import unittest +from typing import ContextManager from parameterized import parameterized from utils.calibration_utils import reset_calibration_file, use_calibration_file from utils.channel_access import ChannelAccess +from utils.emulator_launcher import LewisLauncher from utils.ioc_launcher import EPICS_TOP, IOCRegister from utils.testing import get_running_lewis_and_ioc, parameterized_list, skip_if_recsim @@ -19,69 +23,85 @@ # PIDs cannot be floating-point PID_TEST_VALUES = [-50, 50, 3000] +SENSORS = ["01", "02", "03", "04", "05", "06"] -class EurothermBaseTests(metaclass=abc.ABCMeta): +PV_SENSORS = ["A01", "A02", "A03", "A04", "A05", "A06"] + + +# This class is only valid for classes which also derive from unittest.TestCase, +# and we can't derive from unittest.TestCase at runtime, because +# unittest would try to execute them as tests +class EurothermBaseTests( + unittest.TestCase if typing.TYPE_CHECKING else object, metaclass=abc.ABCMeta +): """ Tests for the Eurotherm temperature controller. """ @abc.abstractmethod - def get_device(self): + def get_device(self) -> str: pass @abc.abstractmethod - def get_emulator_device(self): + def get_emulator_device(self) -> str: pass @abc.abstractmethod - def _get_temperature_setter_wrapper(self): + def _get_temperature_setter_wrapper(self) -> ContextManager: pass @abc.abstractmethod - def get_scaling(self): + def get_scaling(self) -> str: pass - def get_prefix(self): + def get_prefix(self) -> str: return "{}:A01".format(self.get_device()) def setUp(self): self._setup_lewis_and_channel_access() self._reset_device_state() self.ca_no_prefix = ChannelAccess() + self._lewis: LewisLauncher def _setup_lewis_and_channel_access(self): - self._lewis, self._ioc = get_running_lewis_and_ioc("eurotherm", "EUROTHRM_01") + self._lewis, self._ioc = get_running_lewis_and_ioc("eurotherm", "EUROTHRM_01") # type:ignore self.ca = ChannelAccess(device_prefix="EUROTHRM_01", default_wait_time=0) self.ca.assert_that_pv_exists("A01:RBV", timeout=30) self.ca.assert_that_pv_exists("A01:CAL:SEL", timeout=10) - def _reset_device_state(self, sensor="A01"): - self._lewis.backdoor_set_on_device("connected", True) + def _reset_device_state(self, sensor=PV_SENSORS[0]): + i = PV_SENSORS.index(sensor) + self._lewis.backdoor_run_function_on_device("set_connected", [SENSORS[i], True]) reset_calibration_file(self.ca, prefix=f"{sensor}:") intial_temp = 0.0 self._set_setpoint_and_current_temperature(intial_temp) - self._lewis.backdoor_set_on_device("ramping_on", False) - self._lewis.backdoor_set_on_device("ramp_rate", 1.0) + self._lewis.backdoor_run_function_on_device("set_ramping_on", [SENSORS[0], True]) + self._lewis.backdoor_run_function_on_device("set_ramp_rate", [SENSORS[0], 1.0]) self.ca.set_pv_value(f"{sensor}:RAMPON:SP", 0, sleep_after_set=0) self._set_setpoint_and_current_temperature(intial_temp) self.ca.assert_that_pv_is(f"{sensor}:TEMP", intial_temp) # Ensure the temperature isn't being changed by a ramp any more - self.ca.assert_that_pv_value_is_unchanged(f"{sensor}:TEMP", 5) + self.ca.assert_that_pv_value_is_unchanged(f"{sensor}:TEMP", wait=3) - def _set_setpoint_and_current_temperature(self, temperature, sensor="A01"): + def _set_setpoint_and_current_temperature(self, temperature, sensor=PV_SENSORS[0]): if IOCRegister.uses_rec_sim: self.ca.set_pv_value(f"{sensor}:SIM:TEMP:SP", temperature) self.ca.assert_that_pv_is(f"{sensor}:SIM:TEMP", temperature) self.ca.assert_that_pv_is(f"{sensor}:SIM:TEMP:SP", temperature) self.ca.assert_that_pv_is(f"{sensor}:SIM:TEMP:SP:RBV", temperature) else: - self._lewis.backdoor_set_on_device("current_temperature", temperature) + i = PV_SENSORS.index(sensor) + self._lewis.backdoor_run_function_on_device( + "set_current_temperature", [SENSORS[i], temperature] + ) self.ca.assert_that_pv_is_number(f"{sensor}:TEMP", temperature, 0.1, timeout=30) - self._lewis.backdoor_set_on_device("ramp_setpoint_temperature", temperature) + self._lewis.backdoor_run_function_on_device( + "set_ramp_setpoint_temperature", [SENSORS[i], temperature] + ) self.ca.assert_that_pv_is_number(f"{sensor}:TEMP:SP:RBV", temperature, 0.1, timeout=30) def test_WHEN_read_rbv_temperature_THEN_rbv_value_is_same_as_backdoor(self): @@ -114,21 +134,25 @@ def test_WHEN_set_ramp_rate_in_K_per_min_THEN_current_temperature_reaches_set_po "A01:TEMP:SP:RBV", setpoint_temperature, tolerance=0.1, timeout=60 ) end = time.time() - self.assertAlmostEquals( + self.assertAlmostEqual( end - start, 60.0 * (setpoint_temperature - start_temperature) / ramp_rate, delta=0.1 * (end - start), ) # Lower tolerance will be too tight given scan rate def test_WHEN_sensor_disconnected_THEN_ramp_setting_is_disabled(self): - self._lewis.backdoor_set_on_device("current_temperature", SENSOR_DISCONNECTED_VALUE) + self._lewis.backdoor_run_function_on_device( + "set_current_temperature", [SENSORS[0], SENSOR_DISCONNECTED_VALUE] + ) self.ca.assert_that_pv_is_number("A01:RAMPON:SP.DISP", 1) def test_GIVEN_sensor_disconnected_WHEN_sensor_reconnected_THEN_ramp_setting_is_enabled(self): - self._lewis.backdoor_set_on_device("current_temperature", SENSOR_DISCONNECTED_VALUE) + self._lewis.backdoor_run_function_on_device( + "set_current_temperature", [SENSORS[0], SENSOR_DISCONNECTED_VALUE] + ) - self._lewis.backdoor_set_on_device("current_temperature", 0) + self._lewis.backdoor_run_function_on_device("set_current_temperature", [SENSORS[0], 0]) self.ca.assert_that_pv_is_number("A01:RAMPON:SP.DISP", 0) @@ -137,7 +161,9 @@ def test_GIVEN_ramp_was_off_WHEN_sensor_disconnected_THEN_ramp_is_off_and_cached ): self.ca.set_pv_value("A01:RAMPON:SP", 0) - self._lewis.backdoor_set_on_device("current_temperature", SENSOR_DISCONNECTED_VALUE) + self._lewis.backdoor_run_function_on_device( + "set_current_temperature", [SENSORS[0], SENSOR_DISCONNECTED_VALUE] + ) self.ca.assert_that_pv_is("A01:RAMPON", "OFF") self.ca.assert_that_pv_is("A01:RAMPON:CACHE", "OFF") @@ -147,7 +173,9 @@ def test_GIVEN_ramp_was_on_WHEN_sensor_disconnected_THEN_ramp_is_off_and_cached_ ): self.ca.set_pv_value("A01:RAMPON:SP", 1) - self._lewis.backdoor_set_on_device("current_temperature", SENSOR_DISCONNECTED_VALUE) + self._lewis.backdoor_run_function_on_device( + "set_current_temperature", [SENSORS[0], SENSOR_DISCONNECTED_VALUE] + ) self.ca.assert_that_pv_is("A01:RAMPON", "OFF") self.ca.assert_that_pv_is("A01:RAMPON:CACHE", "ON") @@ -155,9 +183,11 @@ def test_GIVEN_ramp_was_on_WHEN_sensor_disconnected_THEN_ramp_is_off_and_cached_ def test_GIVEN_ramp_was_on_WHEN_sensor_disconnected_and_reconnected_THEN_ramp_is_on(self): self.ca.set_pv_value("A01:RAMPON:SP", 1) - self._lewis.backdoor_set_on_device("current_temperature", SENSOR_DISCONNECTED_VALUE) + self._lewis.backdoor_run_function_on_device( + "set_current_temperature", [SENSORS[0], SENSOR_DISCONNECTED_VALUE] + ) self.ca.assert_that_pv_is("A01:RAMPON", "OFF") - self._lewis.backdoor_set_on_device("current_temperature", 0) + self._lewis.backdoor_run_function_on_device("set_current_temperature", [SENSORS[0], 0]) self.ca.assert_that_pv_is("A01:RAMPON", "ON") @@ -265,7 +295,7 @@ def test_WHEN_config_file_and_temperature_unit_changed_THEN_then_ramp_rate_unit_ ] ) def test_GIVEN_None_txt_calibration_file_WHEN_temperature_is_set_THEN( - self, _, temperature, expected_value_of_under_range_calc_pv + self, _, temperature, exp_val ): # Arrange @@ -282,10 +312,10 @@ def test_GIVEN_None_txt_calibration_file_WHEN_temperature_is_set_THEN( # Assert self.ca.assert_that_pv_is("A01:TEMP:RANGE:UNDER.A", temperature) - self.ca.assert_that_pv_is("A01:TEMP:RANGE:UNDER", expected_value_of_under_range_calc_pv) + self.ca.assert_that_pv_is("A01:TEMP:RANGE:UNDER", expected_value=exp_val) - @parameterized.expand( - [ + def test_WHEN_disconnected_THEN_in_alarm(self): + records = [ "A01:TEMP", "A01:TEMP:SP:RBV", "A01:P", @@ -295,43 +325,48 @@ def test_GIVEN_None_txt_calibration_file_WHEN_temperature_is_set_THEN( "A01:MAX_OUTPUT", "A01:LOWLIM", ] - ) - def test_WHEN_disconnected_THEN_in_alarm(self, record): - self.ca.assert_that_pv_alarm_is(record, ChannelAccess.Alarms.NONE) - with self._lewis.backdoor_simulate_disconnected_device(): - self.ca.assert_that_pv_alarm_is(record, ChannelAccess.Alarms.INVALID, timeout=60) + for record in records: + self.ca.assert_that_pv_alarm_is(record, ChannelAccess.Alarms.NONE) + with self._lewis.backdoor_simulate_disconnected_addr(): + for record in records: + self.ca.assert_that_pv_alarm_is(record, ChannelAccess.Alarms.INVALID, timeout=60) # Assert alarms clear on reconnection with self._get_temperature_setter_wrapper(): - self.ca.assert_that_pv_alarm_is(record, ChannelAccess.Alarms.NONE, timeout=30) + for record in records: + self.ca.assert_that_pv_alarm_is(record, ChannelAccess.Alarms.NONE, timeout=30) + + def test_WHEN_eurotherm_missing_THEN_updates_of_PVs_stop(self): + with self._lewis.backdoor_simulate_disconnected_addr(): + self.ca.assert_that_pv_value_is_unchanged("A01:RBV", 20) @parameterized.expand(parameterized_list(PID_TEST_VALUES)) @skip_if_recsim("Backdoor not available in recsim") def test_WHEN_p_set_via_backdoor_THEN_p_updates(self, _, val): - self._lewis.backdoor_set_on_device("p", val) + self._lewis.backdoor_run_function_on_device("set_p", [SENSORS[0], val]) self.ca.assert_that_pv_is_number("A01:P", val, tolerance=0.05, timeout=15) @parameterized.expand(parameterized_list(PID_TEST_VALUES)) @skip_if_recsim("Backdoor not available in recsim") def test_WHEN_i_set_via_backdoor_THEN_i_updates(self, _, val): - self._lewis.backdoor_set_on_device("i", val) + self._lewis.backdoor_run_function_on_device("set_i", [SENSORS[0], val]) self.ca.assert_that_pv_is_number("A01:I", val, tolerance=0.05, timeout=15) @parameterized.expand(parameterized_list(PID_TEST_VALUES)) @skip_if_recsim("Backdoor not available in recsim") def test_WHEN_d_set_via_backdoor_THEN_d_updates(self, _, val): - self._lewis.backdoor_set_on_device("d", val) + self._lewis.backdoor_run_function_on_device("set_d", [SENSORS[0], val]) self.ca.assert_that_pv_is_number("A01:D", val, tolerance=0.05, timeout=15) @parameterized.expand(parameterized_list(TEST_VALUES)) @skip_if_recsim("Backdoor not available in recsim") def test_WHEN_output_set_via_backdoor_THEN_output_updates(self, _, val): - self._lewis.backdoor_set_on_device("output", val) + self._lewis.backdoor_run_function_on_device("set_output", [SENSORS[0], val]) self.ca.assert_that_pv_is_number("A01:OUTPUT", val, tolerance=0.05, timeout=15) @parameterized.expand(parameterized_list(TEST_VALUES)) @skip_if_recsim("Backdoor not available in recsim") - def test_WHEN_output_set_via_backdoor_THEN_output_updates(self, _, val): - self._lewis.backdoor_set_on_device("max_output", val) + def test_WHEN_max_output_set_via_backdoor_THEN_output_updates(self, _, val): + self._lewis.backdoor_run_function_on_device("set_max_output", [SENSORS[0], val]) self.ca.assert_that_pv_is_number("A01:MAX_OUTPUT", val, tolerance=0.05, timeout=15) @parameterized.expand(parameterized_list([0, 100, 3276])) @@ -343,11 +378,11 @@ def test_WHEN_output_rate_set_THEN_output_rate_updates(self, _, val): @parameterized.expand(parameterized_list(TEST_VALUES)) @skip_if_recsim("Backdoor not available in recsim") def test_WHEN_high_limit_set_via_backdoor_THEN_high_lim_updates(self, _, val): - self._lewis.backdoor_set_on_device("high_lim", val) + self._lewis.backdoor_run_function_on_device("set_high_lim", [SENSORS[0], val]) self.ca.assert_that_pv_is_number("A01:HILIM", val, tolerance=0.05, timeout=15) @parameterized.expand(parameterized_list(TEST_VALUES)) @skip_if_recsim("Backdoor not available in recsim") def test_WHEN_low_limit_set_via_backdoor_THEN_low_lim_updates(self, _, val): - self._lewis.backdoor_set_on_device("low_lim", val) + self._lewis.backdoor_run_function_on_device("set_low_lim", [SENSORS[0], val]) self.ca.assert_that_pv_is_number("A01:LOWLIM", val, tolerance=0.05, timeout=15) diff --git a/tests/eurotherm_eibisynch.py b/tests/eurotherm_eibisynch.py index 8f09a37e..ab1fb334 100644 --- a/tests/eurotherm_eibisynch.py +++ b/tests/eurotherm_eibisynch.py @@ -9,13 +9,14 @@ EurothermBaseTests, ) from utils.calibration_utils import use_calibration_file +from utils.emulator_launcher import LewisLauncher from utils.ioc_launcher import ProcServLauncher, get_default_ioc_dir from utils.test_modes import TestModes DEVICE = "EUROTHRM_01" EMULATOR = "eurotherm" SCALING = "1.0" - +TEST_MODES = [TestModes.DEVSIM] IOCS = [ { "name": DEVICE, @@ -39,13 +40,11 @@ ] -TEST_MODES = [TestModes.DEVSIM] - - class EurothermTests(EurothermBaseTests, unittest.TestCase): def setUp(self): super(EurothermTests, self).setUp() - self._lewis.backdoor_set_on_device("scaling", 1.0 / float(SCALING)) + self._lewis.backdoor_run_function_on_device("set_scaling", ["01", 1.0]) + self._lewis: LewisLauncher def get_device(self): return DEVICE @@ -67,8 +66,8 @@ def _get_temperature_setter_wrapper(self): ] ) def test_GIVEN_None_txt_calibration_file_WHEN_temperature_is_set_THEN( - self, _, temperature, expected_value_of_over_range_calc_pv - ): + self, _: str, temperature: float, exp_val: float + ) -> None: """ Note: this test can only run on BISYNCH eurotherms, modbus max temperature is 6553.5 but ramp file goes up to 10,000 and this test attempts to check this behaviour @@ -85,17 +84,18 @@ def test_GIVEN_None_txt_calibration_file_WHEN_temperature_is_set_THEN( # Assert self.ca.assert_that_pv_is("A01:TEMP:RANGE:OVER.A", temperature) - self.ca.assert_that_pv_is("A01:TEMP:RANGE:OVER", expected_value_of_over_range_calc_pv) + self.ca.assert_that_pv_is("A01:TEMP:RANGE:OVER", expected_value=exp_val) - def test_GIVEN_None_txt_calibration_file_WHEN_changed_to_C006_txt_calibration_file_THEN_the_calibration_limits_change( + def test_GIVEN_None_txt_calib_file_WHEN_changed_to_C006_calib_file_THEN_the_calib_limits_change( self, - ): + ) -> None: """ - Note: this test can only run on BISYNCH eurotherms, modbus max temperature is 6553.5 but ramp file goes up + Note: this test can only run on BISYNCH eurotherms, + modbus max temperature is 6553.5 but ramp file goes up to 10,000 and this test attempts to check this behaviour """ - C006_CALIBRATION_FILE_MAX = 330.26135292267900000000 - C006_CALIBRATION_FILE_MIN = 1.20927230303971000000 + c006_calibration_file_max = 330.26135292267900000000 + c006_calibration_file_min = 1.20927230303971000000 # Arrange self._assert_using_mock_table_location() @@ -109,33 +109,41 @@ def test_GIVEN_None_txt_calibration_file_WHEN_changed_to_C006_txt_calibration_fi # Act: with use_calibration_file(self.ca, "C006.txt", prefix="A01:"): # Assert - self.ca.assert_that_pv_is("A01:TEMP:RANGE:OVER.B", C006_CALIBRATION_FILE_MAX) - self.ca.assert_that_pv_is("A01:TEMP:RANGE:UNDER.B", C006_CALIBRATION_FILE_MIN) + self.ca.assert_that_pv_is("A01:TEMP:RANGE:OVER.B", c006_calibration_file_max) + self.ca.assert_that_pv_is("A01:TEMP:RANGE:UNDER.B", c006_calibration_file_min) - def test_GIVEN_simulated_delay_WHEN_temperature_read_from_multiple_sensors_THEN_all_reads_correct( - self, - ): - self._lewis.backdoor_set_on_device("delay_time", 300 / 1000) + def test_GIVEN_sim_delay_WHEN_temp_read_from_many_sensors_THEN_all_reads_correct(self) -> None: + self._lewis.backdoor_run_function_on_device("set_delay_time", [(300 / 1000)]) + for id in range(1, 7): + pv_sensor = f"A{id:02}" + sensor = f"{id:02}" - for temp in range(1, 10): - self._lewis.backdoor_set_on_device("current_temperature", float(temp)) - for id in range(1, 7): - sensor = f"A{id:02}" - self.ca.assert_that_pv_is(f"{sensor}:RBV", float(temp)) + for temp in range(1, 3): + self._lewis.backdoor_run_function_on_device( + "set_current_temperature", [sensor, float(temp)] + ) + self.ca.assert_that_pv_is(f"{pv_sensor}:RBV", float(temp)) - self._lewis.backdoor_set_on_device("delay_time", None) + self._lewis.backdoor_run_function_on_device("set_delay_time", [0.0]) - def test_GIVEN_simulated_delay_WHEN_temperature_set_on_multiple_sensors_THEN_all_reads_correct( - self, - ): - self._lewis.backdoor_set_on_device("delay_time", 300 / 1000) - for id in range(1, 7): - sensor = f"A{id:02}" - self._reset_device_state(sensor=sensor) + def test_GIVEN_sim_delay_WHEN_temp_set_on_multiple_sensors_THEN_all_reads_correct(self) -> None: + self._lewis.backdoor_run_function_on_device("set_delay_time", [(300 / 1000)]) for id in range(1, 7): sensor = f"A{id:02}" - for temp in range(1, 5): + for temp in range(1, 3): self._set_setpoint_and_current_temperature(float(temp), sensor=sensor) self.ca.assert_that_pv_is(f"{sensor}:RBV", float(temp), timeout=30.0) - self._lewis.backdoor_set_on_device("delay_time", None) + self._lewis.backdoor_run_function_on_device("set_delay_time", [0.0]) + + def test_GIVEN_many_sensors_WHEN_one_sensor_disconnect_THEN_other_sensors_read_ok(self) -> None: + # Ensure that A02 is connected + self._lewis.backdoor_run_function_on_device("set_connected", ["02", True]) + + # Disconnect A01 and check PV for A01 is in alarm, and PV for A02 is not: + with self._lewis.backdoor_simulate_disconnected_addr(): + self.ca.assert_that_pv_alarm_is("A01:TEMP", self.ca.Alarms.INVALID, timeout=30) + self.ca.assert_that_pv_alarm_is_not("A02:TEMP", self.ca.Alarms.INVALID, timeout=30) + + # Ensure that after backdoor_run_function, the PV for A01 gets reconnected: + self.ca.assert_that_pv_alarm_is("A01:TEMP", self.ca.Alarms.NONE, timeout=30) diff --git a/tests/eurotherm_modbus.py b/tests/eurotherm_modbus.py index 0a0b2d1f..0f54a031 100644 --- a/tests/eurotherm_modbus.py +++ b/tests/eurotherm_modbus.py @@ -4,6 +4,7 @@ from parameterized import parameterized from common_tests.eurotherm import PID_TEST_VALUES, EurothermBaseTests +from utils.emulator_launcher import LewisLauncher from utils.ioc_launcher import ProcServLauncher, get_default_ioc_dir from utils.test_modes import TestModes from utils.testing import parameterized_list @@ -19,7 +20,6 @@ "ioc_launcher_class": ProcServLauncher, "macros": { "COMMS_MODE": "modbus", - "NEEDLE_VALVE": "no", "ADDR_1": "01", "ADDR_2": "", "ADDR_3": "", @@ -45,11 +45,16 @@ TEST_MODES = [TestModes.DEVSIM] +sensors = ["01", "02", "03", "04", "05", "06"] + class EurothermModbusTests(EurothermBaseTests, unittest.TestCase): def setUp(self): super(EurothermModbusTests, self).setUp() - self._lewis.backdoor_set_on_device("scaling", 1.0 / float(SCALING)) + self._lewis.backdoor_run_function_on_device( + "set_scaling", [sensors[0], 1.0 / float(SCALING)] + ) + self._lewis: LewisLauncher def get_device(self): return DEVICE diff --git a/tests/eurotherm_modbus_needlevalve.py b/tests/eurotherm_modbus_needlevalve.py index 0497dbb8..a32afe4f 100644 --- a/tests/eurotherm_modbus_needlevalve.py +++ b/tests/eurotherm_modbus_needlevalve.py @@ -5,6 +5,7 @@ from common_tests.eurotherm import EurothermBaseTests from utils.channel_access import ChannelAccess +from utils.emulator_launcher import LewisLauncher from utils.ioc_launcher import ProcServLauncher, get_default_ioc_dir from utils.test_modes import TestModes from utils.testing import ManagerMode, parameterized_list, skip_if_recsim @@ -59,13 +60,18 @@ TEST_MODES = [TestModes.DEVSIM] +SENSORS = ["01", "02", "03", "04", "05", "06"] + class EurothermModbusNeedleValveTests(EurothermBaseTests, unittest.TestCase): def setUp(self): super(EurothermModbusNeedleValveTests, self).setUp() - self._lewis.backdoor_set_on_device("scaling", 1.0 / float(SCALING)) + self._lewis.backdoor_run_function_on_device( + "set_scaling", [SENSORS[0], 1.0 / float(SCALING)] + ) with ManagerMode(ChannelAccess()): self.ca.set_pv_value("A01:FLOW_SP_MODE_SELECT:SP", "AUTO") + self._lewis: LewisLauncher def get_device(self): return DEVICE @@ -82,12 +88,12 @@ def _get_temperature_setter_wrapper(self): # READ TESTS @skip_if_recsim("Backdoor not available in recsim") def test_WHEN_using_needle_valve_THEN_flow_exists(self): - self._lewis.backdoor_set_on_device("needlevalve_flow", 5.0) + self._lewis.backdoor_run_function_on_device("set_needlevalve_flow", [SENSORS[0], 5.0]) self.ca.assert_that_pv_is_number("A01:FLOW", 5.0, tolerance=0, timeout=15) @skip_if_recsim("Backdoor not available in recsim") def test_WHEN_using_needle_valve_THEN_valve_dir_exists(self): - self._lewis.backdoor_set_on_device("needlevalve_direction", 1) + self._lewis.backdoor_run_function_on_device("set_needlevalve_direction", [SENSORS[0], 1]) self.ca.assert_that_pv_is("A01:VALVE_DIR", "OPENING", timeout=15) # WRITE TESTS diff --git a/utils/emulator_launcher.py b/utils/emulator_launcher.py index 3f28206d..fe951caa 100644 --- a/utils/emulator_launcher.py +++ b/utils/emulator_launcher.py @@ -480,6 +480,17 @@ def backdoor_simulate_disconnected_device( finally: self.backdoor_set_on_device(emulator_property, True) + @contextlib.contextmanager + def backdoor_simulate_disconnected_addr(self, emulator_property="address"): + """ + Simulate device with disconnected ADDR, such as Eurotherm + """ + self.backdoor_run_function_on_device("set_connected", ["01", False]) + try: + yield + finally: + self.backdoor_run_function_on_device("set_connected", ["01", True]) + class NullEmulatorLauncher(EmulatorLauncher): """ diff --git a/utils/ioc_launcher.py b/utils/ioc_launcher.py index 4294fa56..0d1a31ce 100644 --- a/utils/ioc_launcher.py +++ b/utils/ioc_launcher.py @@ -377,7 +377,7 @@ def _get_telnet(self) -> telnetlib.Telnet: def get_environment_vars(self) -> dict[str, str]: settings = super(ProcServLauncher, self).get_environment_vars() - settings["CYGWIN"] = "nodosfilewarning" + settings["CYGWIN"] = "disable_pcon" settings["MYDIRPROCSV"] = os.path.join(EPICS_TOP, "iocstartup") settings["EPICS_CAS_INTF_ADDR_LIST"] = "127.0.0.1" settings["EPICS_CAS_BEACON_ADDR_LIST"] = "127.255.255.255"