From ba8e361e4f61f48d27e543903cd1e49564f2fd4f Mon Sep 17 00:00:00 2001 From: Isaac Hill Date: Mon, 17 Jun 2024 16:23:06 +0100 Subject: [PATCH] Launch emulator with procserv launcher due to need to test with specific macros --- tests/tpg500.py | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/tests/tpg500.py b/tests/tpg500.py index 68a86018..e65c8a7b 100644 --- a/tests/tpg500.py +++ b/tests/tpg500.py @@ -3,7 +3,7 @@ from parameterized import parameterized from common_tests.tpgx00 import Tpgx00Base -from utils.ioc_launcher import get_default_ioc_dir +from utils.ioc_launcher import get_default_ioc_dir, ProcServLauncher from utils.test_modes import TestModes from utils.testing import skip_if_recsim, parameterized_list from enum import Enum @@ -15,14 +15,15 @@ IOCS = [ { - "name": DEVICE_PREFIX, - "directory": get_default_ioc_dir("TPG300"), - "macros": { - "MODEL": "500" - }, - "emulator": "tpgx00", - "lewis_protocol": "tpg500", - "pv_for_existence": "UNITS", + "name": DEVICE_PREFIX, + "directory": get_default_ioc_dir("TPG300"), + "macros": { + "MODEL": "500" + }, + "emulator": "tpgx00", + "lewis_protocol": "tpg500", + "pv_for_existence": "UNITS", + "ioc_launcher_class": ProcServLauncher, }, ] @@ -31,14 +32,15 @@ SWITCHING_FUNCTIONS = ("SEL", "1", "2", "3", "4") + class SFAssignment(Enum): - OFF = (0, "Switched off") - A1 = (1, "A1") - A2 = (2, "A2") - B1 = (3, "B1") - B2 = (4, "B2") - ON = (5, "Switched on") - + OFF = (0, "Switched off") + A1 = (1, "A1") + A2 = (2, "A2") + B1 = (3, "B1") + B2 = (4, "B2") + ON = (5, "Switched on") + def __new__(cls, value, desc): obj = object.__new__(cls) obj._value_ = value @@ -63,13 +65,13 @@ class Tpg500Tests(Tpgx00Base, unittest.TestCase): def get_prefix(self): return DEVICE_PREFIX - + def get_units(self): return Units def get_sf_assignment(self): return SFAssignment - + def get_switching_fns(self): return SWITCHING_FUNCTIONS @@ -79,4 +81,5 @@ def test_WHEN_invalid_switching_function_set_THEN_pv_goes_into_alarm(self, _, sw with self.assertRaises(InvalidEnumStringException): self.ca.set_pv_value("FUNCTION", switching_func) self.ca.assert_that_pv_is_not("FUNCTION", switching_func) - self._lewis.assert_that_emulator_value_is_not("backdoor_get_switching_fn", switching_func) + self._lewis.assert_that_emulator_value_is_not( + "backdoor_get_switching_fn", switching_func)