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 10, 2023
1 parent 8d66aae commit 7d94cfc
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 17 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.
3 changes: 3 additions & 0 deletions tests/test_simulated_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
ioc_dir = Path(__file__).parent.resolve() / "iocs"


pytest.skip(allow_module_level=True)


def test_simulated_ioc(ioc_simple):
assert caget(ioc_simple.pvs["B"], use_monitor=False) == 2.0
caput(ioc_simple.pvs["B"], 5)
Expand Down

0 comments on commit 7d94cfc

Please sign in to comment.