diff --git a/robot-server/robot_server/client_data/router.py b/robot-server/robot_server/client_data/router.py index 847c5da59a9..806e7710634 100644 --- a/robot-server/robot_server/client_data/router.py +++ b/robot-server/robot_server/client_data/router.py @@ -25,7 +25,7 @@ Key = Annotated[ str, fastapi.Path( - regex="^[a-zA-Z0-9-_]*$", + pattern="^[a-zA-Z0-9-_]*$", description=( "A key for storing and retrieving the piece of data." " This should be chosen to avoid colliding with other clients," diff --git a/robot-server/tests/runs/test_run_store.py b/robot-server/tests/runs/test_run_store.py index 400e5ef6a06..52cf0ba8173 100644 --- a/robot-server/tests/runs/test_run_store.py +++ b/robot-server/tests/runs/test_run_store.py @@ -3,6 +3,7 @@ from datetime import datetime, timezone from pathlib import Path from typing import List, Optional, Type +import warnings import pytest from decoy import Decoy @@ -689,12 +690,22 @@ def test_get_state_summary_failure( protocol_id=None, created_at=datetime(year=2021, month=1, day=1, tzinfo=timezone.utc), ) - subject.update_run_state( - run_id="run-id", - summary=invalid_state_summary, - commands=[], - run_time_parameters=[], - ) + + with warnings.catch_warnings(): + # Pydantic raises a warning because invalid_state_summary (deliberately) + # has a wrongly-typed value in one of its fields. Ignore the warning. + warnings.filterwarnings( + action="ignore", + category=UserWarning, + module="pydantic", + ) + subject.update_run_state( + run_id="run-id", + summary=invalid_state_summary, + commands=[], + run_time_parameters=[], + ) + result = subject.get_state_summary(run_id="run-id") assert isinstance(result, BadStateSummary) assert result.dataError.code == ErrorCodes.INVALID_STORED_DATA