From 70c89448653001e8ec10f878ce897e56e1628561 Mon Sep 17 00:00:00 2001 From: Mark Wolfman Date: Fri, 10 Nov 2023 16:52:46 -0600 Subject: [PATCH] Moved the remaining tests out of tests/ and skipped the simulated IOC tests. --- .../haven/tests}/test_align_motor.py | 0 .../haven/tests}/test_beam_properties.py | 0 {tests => src/haven/tests}/test_camera.py | 0 {tests => src/haven/tests}/test_iconfig.py | 0 {tests => src/haven/tests}/test_iconfig.toml | 0 .../haven/tests}/test_instrument_registry.py | 0 .../tests}/test_mono_ID_calibration_plan.py | 0 {tests => src/haven/tests}/test_plans.py | 0 {tests => src/haven/tests}/test_run_engine.py | 0 .../haven/tests}/test_save_motor_positions.py | 27 +++++++------------ .../haven/tests}/test_scaler_triggering.py | 0 {tests => src/haven/tests}/test_xdi_writer.py | 0 tests/run_engine.py | 0 tests/test_simulated_ioc.py | 14 +++++++--- 14 files changed, 21 insertions(+), 20 deletions(-) rename {tests => src/haven/tests}/test_align_motor.py (100%) rename {tests => src/haven/tests}/test_beam_properties.py (100%) rename {tests => src/haven/tests}/test_camera.py (100%) rename {tests => src/haven/tests}/test_iconfig.py (100%) rename {tests => src/haven/tests}/test_iconfig.toml (100%) rename {tests => src/haven/tests}/test_instrument_registry.py (100%) rename {tests => src/haven/tests}/test_mono_ID_calibration_plan.py (100%) rename {tests => src/haven/tests}/test_plans.py (100%) rename {tests => src/haven/tests}/test_run_engine.py (100%) rename {tests => src/haven/tests}/test_save_motor_positions.py (92%) rename {tests => src/haven/tests}/test_scaler_triggering.py (100%) rename {tests => src/haven/tests}/test_xdi_writer.py (100%) delete mode 100644 tests/run_engine.py diff --git a/tests/test_align_motor.py b/src/haven/tests/test_align_motor.py similarity index 100% rename from tests/test_align_motor.py rename to src/haven/tests/test_align_motor.py diff --git a/tests/test_beam_properties.py b/src/haven/tests/test_beam_properties.py similarity index 100% rename from tests/test_beam_properties.py rename to src/haven/tests/test_beam_properties.py diff --git a/tests/test_camera.py b/src/haven/tests/test_camera.py similarity index 100% rename from tests/test_camera.py rename to src/haven/tests/test_camera.py diff --git a/tests/test_iconfig.py b/src/haven/tests/test_iconfig.py similarity index 100% rename from tests/test_iconfig.py rename to src/haven/tests/test_iconfig.py diff --git a/tests/test_iconfig.toml b/src/haven/tests/test_iconfig.toml similarity index 100% rename from tests/test_iconfig.toml rename to src/haven/tests/test_iconfig.toml diff --git a/tests/test_instrument_registry.py b/src/haven/tests/test_instrument_registry.py similarity index 100% rename from tests/test_instrument_registry.py rename to src/haven/tests/test_instrument_registry.py diff --git a/tests/test_mono_ID_calibration_plan.py b/src/haven/tests/test_mono_ID_calibration_plan.py similarity index 100% rename from tests/test_mono_ID_calibration_plan.py rename to src/haven/tests/test_mono_ID_calibration_plan.py diff --git a/tests/test_plans.py b/src/haven/tests/test_plans.py similarity index 100% rename from tests/test_plans.py rename to src/haven/tests/test_plans.py diff --git a/tests/test_run_engine.py b/src/haven/tests/test_run_engine.py similarity index 100% rename from tests/test_run_engine.py rename to src/haven/tests/test_run_engine.py diff --git a/tests/test_save_motor_positions.py b/src/haven/tests/test_save_motor_positions.py similarity index 92% rename from tests/test_save_motor_positions.py rename to src/haven/tests/test_save_motor_positions.py index 725ba036..613cfd89 100644 --- a/tests/test_save_motor_positions.py +++ b/src/haven/tests/test_save_motor_positions.py @@ -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 @@ -165,22 +164,18 @@ 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, @@ -188,10 +183,8 @@ def test_motor_position_e2e(mongodb, ioc_motor): 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) diff --git a/tests/test_scaler_triggering.py b/src/haven/tests/test_scaler_triggering.py similarity index 100% rename from tests/test_scaler_triggering.py rename to src/haven/tests/test_scaler_triggering.py diff --git a/tests/test_xdi_writer.py b/src/haven/tests/test_xdi_writer.py similarity index 100% rename from tests/test_xdi_writer.py rename to src/haven/tests/test_xdi_writer.py diff --git a/tests/run_engine.py b/tests/run_engine.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/test_simulated_ioc.py b/tests/test_simulated_ioc.py index 5dd8c11a..a0551ece 100644 --- a/tests/test_simulated_ioc.py +++ b/tests/test_simulated_ioc.py @@ -15,6 +15,7 @@ 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) @@ -22,6 +23,7 @@ def test_simulated_ioc(ioc_simple): 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 @@ -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) @@ -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 @@ -111,6 +114,7 @@ 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) @@ -118,6 +122,7 @@ def test_bss_ioc(ioc_bss): 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") @@ -144,6 +149,7 @@ 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 @@ -151,11 +157,12 @@ def test_ptc10_ioc(ioc_ptc10): 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) @@ -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")