From 9b202f8a74af8aad5cc3e563e24243d791c1b1c1 Mon Sep 17 00:00:00 2001 From: appel_c Date: Wed, 12 Nov 2025 08:04:23 +0100 Subject: [PATCH] tests(psi-motors): add test for high limit switch --- tests/test_psi_motors.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_psi_motors.py b/tests/test_psi_motors.py index 4d61509..521b28d 100644 --- a/tests/test_psi_motors.py +++ b/tests/test_psi_motors.py @@ -165,3 +165,13 @@ def test_move_epics_motor_ec(mock_epics_motor_ec): status.wait(timeout=5) assert status.done is True motor_ec.low_interlock._read_pv.mock_data = 0 + + +def test_epics_motor_high_limit_switch_raises(mock_epics_motor): + """Test that moving beyond high limit switch raises an error.""" + motor = mock_epics_motor + motor.user_setpoint._metadata["lower_ctrl_limit"] = -10 + motor.user_setpoint._metadata["upper_ctrl_limit"] = 10 + motor.high_limit_switch._read_pv.mock_data = 1 # Simulate high limit switch active + with pytest.raises(ophyd.utils.LimitError): + motor.move(15)