Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch tpg500 emulator with procserv launcher #634

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions tests/tpg500.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
},
]

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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)