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

@ -18,7 +18,7 @@ classifiers = [
"Operating System :: OS Independent", "Operating System :: OS Independent",
] ]
dependencies = [ dependencies = [
"labthings-fastapi==0.0.13", "labthings-fastapi==0.0.14",
"sangaboard", "sangaboard",
"camera-stage-mapping ~= 0.1.10", "camera-stage-mapping ~= 0.1.10",
"opencv-python ~= 4.11.0", "opencv-python ~= 4.11.0",

View file

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