Move hardware-specific-tests to tests dir
This commit is contained in:
parent
4e043f3df2
commit
ef9a88104b
13 changed files with 7 additions and 221 deletions
|
|
@ -1,37 +0,0 @@
|
|||
"""Utilities to help with testing the camera."""
|
||||
|
||||
from contextlib import contextmanager
|
||||
from typing import Optional
|
||||
|
||||
from openflexure_microscope_server.things.camera.picamera import StreamingPiCamera2
|
||||
|
||||
from ..tests.utilities.lt_test_utils import LabThingsTestEnv
|
||||
|
||||
|
||||
@contextmanager
|
||||
def camera_test_env(settings_folder: Optional[str] = None):
|
||||
"""Yield a test environment with a server that contains just the camera.
|
||||
|
||||
This is a context manager, not a pytest fixture, as it needs to be created
|
||||
multiple times in some tests.
|
||||
|
||||
:param settings_folder: The settings folder for the camera, if none is supplied, new
|
||||
temporary directory will be used as the settings folder.
|
||||
"""
|
||||
thing_conf = {"camera": StreamingPiCamera2}
|
||||
with LabThingsTestEnv(things=thing_conf, settings_folder=settings_folder) as env:
|
||||
yield env
|
||||
|
||||
|
||||
@contextmanager
|
||||
def camera_test_client(settings_folder: Optional[str] = None):
|
||||
"""Yield a camera ThingClient on a camera server.
|
||||
|
||||
This is a context manager, not a pytest fixture, as it needs to be created
|
||||
multiple times in some tests.
|
||||
|
||||
:param settings_folder: The settings folder for the camera, if none is supplied, new
|
||||
temporary directory will be used as the settings folder.
|
||||
"""
|
||||
with camera_test_env(settings_folder=settings_folder) as env:
|
||||
return env.get_thing_client("camera")
|
||||
Loading…
Add table
Add a link
Reference in a new issue