Files
orisys-sdk/tests/test_errors_and_cleanup.py
2026-03-09 13:33:18 +08:00

33 lines
889 B
Python

from pathlib import Path
import pytest
from orisys import Sensor
def test_compute_deformation_requires_get_img(sensor_factory):
sensor = sensor_factory(backend="cpu")
try:
with pytest.raises(Exception):
sensor.compute_deformation(check_motion=False)
finally:
sensor.disconnect()
def test_invalid_video_source_raises():
bad_path = Path("this_video_file_should_not_exist_123456.mp4")
with pytest.raises(Exception):
sensor = Sensor(vid_src=str(bad_path), verbose=False, backend="cpu")
sensor.disconnect()
def test_repeated_connect_disconnect(sensor_factory):
for _ in range(3):
sensor = sensor_factory(backend="cpu")
try:
img = sensor.get_img()
assert img is not None
sensor.compute_deformation(check_motion=False)
finally:
sensor.disconnect()