Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/blueapi/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,12 @@ def __get_pydantic_core_schema__(
) -> CoreSchema:
def valid(value):
val = self.find_device(value)
if not val or not is_compatible(
val, cls.origin or target, cls.args
):
required = qualified_generic_name(target)
if not val:
raise ValueError(f"Device {value} cannot be found")
elif not is_compatible(val, cls.origin or target, cls.args):
req = qualified_generic_name(target)
raise ValueError(
f"Device {value} is not of type {required}"
f"Device {value} ({type(val)}) is not of type {req}"
)
return val

Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/worker/test_task_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def missing_injection(dev: FakeDevice = inject("does_not_exist")) -> MsgGenerato
yield from ()

context.register_plan(missing_injection)
with pytest.raises(ValueError):
with pytest.raises(ValueError, match="Device does_not_exist cannot be found"):
Task(name="missing_injection").prepare_params(context)


Expand Down