Commit 4993acd1 authored by Jibril Mammeri's avatar Jibril Mammeri
Browse files

Improve message when hard limit is reached

parent 996e88ef
Pipeline #35415 failed with stages
in 85 minutes and 4 seconds
......@@ -1911,7 +1911,9 @@ class Axis:
if not state.MOVING:
if limit_error and (state.LIMPOS or state.LIMNEG):
raise AxisOnLimitError(str(state))
raise AxisOnLimitError(
f"{}: {str(state)} at {self.position}"
elif state.FAULT:
raise AxisFaultError(str(state))
return state
......@@ -6,6 +6,8 @@
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import pytest
from unittest import mock
from bliss.common.axis import AxisState, AxisOnLimitError
def test_axis_stdout(roby, capsys, log_shell_mode):
......@@ -47,3 +49,16 @@ def test_axis_stdout2(roby, bad_motor, capsys, log_shell_mode):
out, err = capsys.readouterr()
assert "Axis roby stopped at position" in out
def test_axis_stderr1(roby):
with mock.patch.object(roby.controller, "state") as new_state:
new_state.return_value = AxisState("READY", "LIMNEG")
assert roby.state.LIMNEG
with pytest.raises(
match=r"roby: READY \(Axis is READY\) \| "
r"LIMNEG \(Hardware low limit active\) at [0-9\.]*",
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment