Fix unit tests for background detectors as Things

This commit is contained in:
Julian Stirling 2026-01-13 19:49:34 +00:00
parent 3e8874188e
commit 6b97d2da44
5 changed files with 51 additions and 116 deletions

View file

@ -36,6 +36,15 @@ class BackgroundDetectAlgorithm(lt.Thing):
display_name: str = lt.property(default="Base Detector", readonly=True)
def __init__(self, thing_server_interface: lt.ThingServerInterface) -> None:
"""Initialise and create the lock."""
if self.display_name == "Base Detector":
raise NotImplementedError(
"Do not try to use the BackgroungDetectAlgorithm directly. "
" Use a subclass"
)
super().__init__(thing_server_interface)
@lt.property
def ready(self) -> bool:
"""Whether the background detector is ready."""

View file

@ -38,7 +38,7 @@ import labthings_fastapi as lt
from labthings_fastapi.exceptions import ServerNotRunningError
from labthings_fastapi.types.numpy import NDArray
from openflexure_microscope_server.background_detect import ChannelBlankError
from openflexure_microscope_server.things.background_detect import ChannelBlankError
from openflexure_microscope_server.ui import (
ActionButton,
PropertyControl,