Test stitch all with mocking

This commit is contained in:
jaknapper 2026-05-15 17:05:08 +01:00
parent bd796f98a1
commit 0f842c622b
4 changed files with 53 additions and 41 deletions

View file

@ -4,6 +4,7 @@ import json
import logging
import os
import re
import tempfile
from collections.abc import Iterable
from contextlib import contextmanager
from typing import Optional
@ -12,6 +13,10 @@ import pytest
from labthings_fastapi.testing import create_thing_without_server
from openflexure_microscope_server.things.smart_scan import (
SmartScanThing,
)
from .shared_utils.lt_test_utils import LabThingsTestEnv
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
@ -105,3 +110,17 @@ def mock_picam_thing(mocker):
from openflexure_microscope_server.things.camera.picamera import StreamingPiCamera2
return create_thing_without_server(StreamingPiCamera2)
@pytest.fixture
def smart_scan_thing(mocker):
"""Return a smart scan thing as a fixture."""
thing = create_thing_without_server(
SmartScanThing,
default_workflow="mock-_all_workflows",
mock_all_slots=True,
)
type(thing._thing_server_interface).application_config = mocker.PropertyMock(
return_value={"data_folder": tempfile.gettempdir()}
)
return thing