Start to move tests onto new camera api

This commit is contained in:
Julian Stirling 2026-05-27 23:28:19 +01:00
parent c18d43a3a5
commit b9c6071bc7
5 changed files with 10 additions and 10 deletions

View file

@ -169,9 +169,9 @@ def test_picamera_metadata_written_to_exif(mock_picam_thing, temp_jpeg, mocker):
mock_interface.get_thing_states.return_value = camera.thing_state
camera._thing_server_interface = mock_interface
capture_metadata = camera._capture_metadata()
ofm_metadata = camera._collect_ofm_metadata()
camera._add_metadata_to_capture(str(temp_jpeg), capture_metadata)
camera._add_metadata_to_capture(str(temp_jpeg), ofm_metadata)
exif_dict = piexif.load(str(temp_jpeg))
user_comment = json.loads(exif_dict["Exif"][piexif.ExifIFD.UserComment].decode())

View file

@ -159,12 +159,12 @@ def test_infinite_sample(camera, stage):
camera.noise_level = 0
assert not camera.repeating
cached_canvas = camera.canvas
array_not_repeating = camera.capture_array()
array_not_repeating = camera.capture_as_array()
camera.repeating = True
time.sleep(0.2) # Ensure frame regenerates
# Canvas shouldn't regenerate
assert camera.canvas is cached_canvas
array_repeating = camera.capture_array()
array_repeating = camera.capture_as_array()
# Images are identical whether or not repeating
assert np.array_equal(array_not_repeating, array_repeating)
@ -174,13 +174,13 @@ def test_infinite_sample(camera, stage):
camera.repeating = False
time.sleep(0.2) # Ensure frame regenerates
# If not repeating the array is just background
assert np.all(camera.capture_array() == simulation.BG_COLOR)
assert np.all(camera.capture_as_array() == simulation.BG_COLOR)
# Turn on repeating
camera.repeating = True
time.sleep(0.2) # Ensure frame regenerates
# Sample is now infinite, so not all background
assert not np.all(camera.capture_array() == simulation.BG_COLOR)
assert not np.all(camera.capture_as_array() == simulation.BG_COLOR)
def test_simulation_cam_calibration(camera):