Skip to content

Commit

Permalink
Merge pull request #144 from lisazacarias/tests
Browse files Browse the repository at this point in the history
Adding sc linac tests
  • Loading branch information
lisazacarias committed Jul 8, 2024
2 parents 479c08c + 00c28e9 commit b6949b6
Show file tree
Hide file tree
Showing 20 changed files with 3,548 additions and 1,905 deletions.
12 changes: 12 additions & 0 deletions lcls_tools/common/controls/pyepics/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from time import sleep
from unittest.mock import MagicMock

from epics import PV as EPICS_PV, caget as epics_caget, caput as epics_caput

Expand Down Expand Up @@ -134,3 +135,14 @@ def put(
if retry and (status != 1):
print(f"{self} put not successful, using caput")
self.caput(value)


def make_mock_pv(
pv_name: str = None, get_val=None, severity=EPICS_NO_ALARM_VAL
) -> MagicMock:
return MagicMock(
pvname=pv_name,
put=MagicMock(return_value=1),
get=MagicMock(return_value=get_val),
severity=severity,
)
5 changes: 3 additions & 2 deletions lcls_tools/common/frontend/widgets/magnet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pydm import Display

from lcls_tools.superconducting import scLinac, sc_linac_utils as utils
import lcls_tools.superconducting.sc_magnet
from lcls_tools.superconducting import sc_linac_utils as utils


class MagnetScreen(Display):
Expand All @@ -10,7 +11,7 @@ def __init__(self, parent=None, args=None):
def ui_filename(self):
return "magnet_template.ui"

def connectSignals(self, magnet: scLinac.Magnet):
def connectSignals(self, magnet: lcls_tools.superconducting.sc_magnet.Magnet):
self.ui.expertButton.macros = ["DEV={dev}".format(dev=magnet.pvprefix[:-1])]
self.ui.magnetGroupBox.setTitle(
"CM{cm} {magnettype}".format(
Expand Down
Loading

0 comments on commit b6949b6

Please sign in to comment.