Bump labthings-fastapi to 0.0.14 and fix error types in unit tests

This commit is contained in:
Julian Stirling 2026-01-09 16:43:14 +00:00
parent e85a1d3080
commit b46f8af8e7
2 changed files with 4 additions and 8 deletions

View file

@ -3,7 +3,6 @@
import itertools
import pytest
from httpx import HTTPStatusError
from hypothesis import HealthCheck, given, settings
from hypothesis import strategies as st
@ -155,10 +154,8 @@ def test_direction_errors_local_and_http():
assert stage_client.axis_inverted == {"x": True, "y": False, "z": False}
# Can't set an arbitrary value via a client as read only:
with pytest.raises(HTTPStatusError) as excinfo:
with pytest.raises(lt.exceptions.ClientPropertyError):
stage_client.axis_inverted = {"x": 2, "y": 1, "z": 1}
# Read only should set a 405 error code ...
assert excinfo.value.response.status_code == 405
# ... and should not modify the initial value
assert stage_client.axis_inverted == {"x": True, "y": False, "z": False}
@ -166,10 +163,9 @@ def test_direction_errors_local_and_http():
# Should error if axis doesn't exist, this is a KeyError in the server
with pytest.raises(KeyError):
dummy_stage.invert_axis_direction(axis="theta")
# But a 422 over HTTP
with pytest.raises(HTTPStatusError) as excinfo:
# But a FailedToInvokeActionError over HTTP
with pytest.raises(lt.exceptions.FailedToInvokeActionError):
stage_client.invert_axis_direction(axis="theta")
assert excinfo.value.response.status_code == 422
def _test_move_relative(dummy_stage, axis_inverted, path):