Commit ae280495 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

tests: add test for invalid configuration

parent d8098b68
......@@ -156,7 +156,7 @@ class AxisSettings:
if value is None:
raise RuntimeError(
"Axis %s: missing configuration key '%s`"
% (self.name, setting_name)
% (axis.name, setting_name)
)
if setting_name == "steps_per_unit":
# steps_per_unit is read-only
......
......@@ -1023,3 +1023,25 @@ def test_no_settings_offset(beacon):
nsa.offset = 1
assert nsa.position == pytest.approx(1)
assert nsa.dial == pytest.approx(0)
def test_invalid_config(beacon):
invalid_cfg = beacon.get_config("invalid_cfg_axis")
invalid_mot = beacon.get("invalid_cfg_axis")
with pytest.raises(RuntimeError) as exc:
invalid_mot.position # lazy init
assert "velocity" in str(exc.value)
invalid_cfg["velocity"] = 1
with pytest.raises(RuntimeError) as exc:
invalid_mot.position # lazy init
assert "acceleration" in str(exc.value)
invalid_cfg["acceleration"] = 1
with pytest.raises(RuntimeError) as exc:
invalid_mot.position # lazy init
assert "steps_per_unit" in str(exc.value)
invalid_cfg["steps_per_unit"] = 1
assert invalid_mot.position == 0
......@@ -247,6 +247,9 @@ controller:
steps_per_unit: 10
acceleration: 100
velocity: 1e9
- class: mockup
axes:
- name: invalid_cfg_axis
- class: EnergyWavelength
axes:
- name: $mono
......
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