Update sensor mode picamera test to ensure that camera tests don't use saved settings
This commit is contained in:
parent
5c56c1e851
commit
d0d30222b4
1 changed files with 2 additions and 11 deletions
|
|
@ -2,25 +2,16 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from fastapi.testclient import TestClient
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from labthings_fastapi.server import ThingServer
|
from .cam_test_utils import camera_test_client
|
||||||
from labthings_fastapi.client import ThingClient
|
|
||||||
|
|
||||||
from openflexure_microscope_server.things.camera.picamera import StreamingPiCamera2
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
def test_sensor_mode():
|
def test_sensor_mode():
|
||||||
"""Test capturing raw arrays in two different sensor modes."""
|
"""Test capturing raw arrays in two different sensor modes."""
|
||||||
cam = StreamingPiCamera2()
|
with camera_test_client() as client:
|
||||||
server = ThingServer()
|
|
||||||
server.add_thing(cam, "/camera/")
|
|
||||||
|
|
||||||
with TestClient(server.app) as test_client:
|
|
||||||
client = ThingClient.from_url("/camera/", client=test_client)
|
|
||||||
for size in [(3280, 2464), (1640, 1232)]:
|
for size in [(3280, 2464), (1640, 1232)]:
|
||||||
client.sensor_mode = {"output_size": size, "bit_depth": 10}
|
client.sensor_mode = {"output_size": size, "bit_depth": 10}
|
||||||
arr = np.array(client.capture_array(stream_name="raw"))
|
arr = np.array(client.capture_array(stream_name="raw"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue