Skip to content

Commit

Permalink
Moved the remaining tests out of tests/ and skipped the simulated IOC…
Browse files Browse the repository at this point in the history
… tests.
  • Loading branch information
canismarko committed Nov 11, 2023
1 parent 8d66aae commit 70c8944
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import datetime as dt
from datetime import datetime

import epics
import pytest
from ophyd.sim import motor1, SynAxis, make_fake_device
from ophyd import EpicsMotor, Signal, Component as Cpt
Expand Down Expand Up @@ -165,33 +164,27 @@ def test_list_motor_positions(mongodb, capsys):
assert captured.out == expected


def test_motor_position_e2e(mongodb, ioc_motor):
def test_motor_position_e2e(mongodb, sim_motor_registry):
"""Check that a motor position can be saved, then recalled using
simulated IOC.
a simulated motor.
"""
# Create an epics motor for setting values manually
pv = ioc_motor.pvs["m1"]
motor1 = EpicsMotor(pv, name="SLT V Upper")
motor1.wait_for_connection(timeout=20)
assert motor1.connected
registry.register(motor1)
registry.find(name="SLT V Upper")
epics.caput(pv, 504.6)
assert epics.caget(pv, use_monitor=False) == 504.6
time.sleep(0.1)
assert motor1.get(use_monitor=False).user_readback == 504.6
motor1 = sim_motor_registry.find(name="SLT V Upper")
# Set a fake value
motor1.set(504.6).wait(timeout=2)
# assert epics.caget(pv, use_monitor=False) == 504.6
# time.sleep(0.1)
assert motor1.get().readback == 504.6
# Save motor position
uid = save_motor_position(
motor1,
name="starting point",
collection=mongodb.motor_positions,
)
# Change to a different value
epics.caput(pv, 520)
time.sleep(0.1)
assert epics.caget(pv, use_monitor=False) == 520
assert motor1.get(use_monitor=False).user_readback == 520
motor1.set(520).wait(timeout=2)
assert motor1.get().readback == 520
# Recall the saved position and see if it complies
plan = recall_motor_position(uid=uid, collection=mongodb.motor_positions)
msg = next(plan)
Expand Down
File renamed without changes.
File renamed without changes.
Empty file removed tests/run_engine.py
Empty file.
14 changes: 11 additions & 3 deletions tests/test_simulated_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
ioc_dir = Path(__file__).parent.resolve() / "iocs"


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_simulated_ioc(ioc_simple):
assert caget(ioc_simple.pvs["B"], use_monitor=False) == 2.0
caput(ioc_simple.pvs["B"], 5)
time.sleep(0.1)
assert caget(ioc_simple.pvs["B"], use_monitor=False) == 5


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_motor_ioc(ioc_motor):
prefix = "255idVME:"
# Check that the starting value is different than what we'll set it to
Expand All @@ -34,14 +36,14 @@ def test_motor_ioc(ioc_motor):
assert caget(f"{prefix}m1.VAL", use_monitor=False) == 4000.0
assert caget(f"{prefix}m1.RBV", use_monitor=False) == 4000.0


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_scaler_ioc(ioc_scaler):
# Check that all the channels have the right counts
for ch_num in range(1, 32):
pv = f"255idVME:scaler1.S{ch_num}"
assert caget(pv) is not None, pv


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_mono_ioc(ioc_mono):
# Test a regular motor
caput("255idMono:ACS:m1", 0)
Expand Down Expand Up @@ -86,6 +88,7 @@ def test_mono_ioc(ioc_mono):
# assert pass_time < 4, msg


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_undulator_ioc(ioc_undulator):
val = caget(ioc_undulator.pvs["energy"], use_monitor=False)
assert val == 0.0
Expand All @@ -111,13 +114,15 @@ def test_undulator_ioc(ioc_undulator):
# pass


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
@pytest.mark.xfail
def test_bss_ioc(ioc_bss):
caput(ioc_bss.pvs["esaf_cycle"], "2023-2", wait=True)
val = caget(ioc_bss.pvs["esaf_cycle"], as_string=True, use_monitor=False)
assert val == "2023-2"


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_preamp_ioc(ioc_preamp):
# Update PVs to recover from other tests
caput(ioc_preamp.pvs["preamp1_sens_num"], "5")
Expand All @@ -144,18 +149,20 @@ def test_preamp_ioc(ioc_preamp):
)


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_ptc10_ioc(ioc_ptc10):
assert caput(ioc_ptc10.pvs["tc1_temperature"], 21.3)
# Check that the values were set
assert caget(ioc_ptc10.pvs["pid1_voltage"], use_monitor=False) == 0
assert caget(ioc_ptc10.pvs["pid1_voltage_rbv"], use_monitor=False) == 0
assert caget(ioc_ptc10.pvs["tc1_temperature"], use_monitor=False) == 21.3


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_area_detector_ioc(ioc_area_detector):
assert caget(ioc_area_detector.pvs["cam_acquire_busy"], use_monitor=False) == 0


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_dxp_ioc_mca_propogation(ioc_dxp):
# See if settings propogate to the MCAs
caput("255idDXP:PresetLive", 1.5)
Expand All @@ -167,6 +174,7 @@ def test_dxp_ioc_mca_propogation(ioc_dxp):
assert real_time == 2.5


@pytest.mark.skip(reason="Simulated IOCs are deprecated.")
def test_dxp_ioc_spectra(ioc_dxp):
# Get the starting spectrum
spectrum = caget("255idDXP:mca1.VAL")
Expand Down

0 comments on commit 70c8944

Please sign in to comment.