Add a first unit test
This checks that the server can start and perform an autofocus. Autofocus in turn will test the camera and stage dependencies.
This commit is contained in:
parent
bccb1ee923
commit
58066f1948
11 changed files with 22 additions and 1700 deletions
22
tests/test_dummy_server.py
Normal file
22
tests/test_dummy_server.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import tempfile
|
||||
|
||||
from fastapi import Depends, FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from labthings_fastapi.client import ThingClient
|
||||
|
||||
from openflexure_microscope_server.server import ThingServer
|
||||
from openflexure_microscope_server.things.camera.simulation import SimulatedCamera
|
||||
from openflexure_microscope_server.things.stage.dummy import DummyStage
|
||||
from openflexure_microscope_server.things.autofocus import AutofocusThing
|
||||
|
||||
temp_folder = tempfile.TemporaryDirectory()
|
||||
server = ThingServer(temp_folder.name)
|
||||
server.add_thing(SimulatedCamera(), "/camera/")
|
||||
server.add_thing(DummyStage(), "/stage/")
|
||||
server.add_thing(AutofocusThing(), "/autofocus/")
|
||||
|
||||
def test_autofocus():
|
||||
with TestClient(server.app) as client:
|
||||
autofocus = ThingClient.from_url("/autofocus/", client)
|
||||
_ = autofocus.fast_autofocus()
|
||||
Loading…
Add table
Add a link
Reference in a new issue