Update paths

This commit is contained in:
Simon Alibert
2025-03-04 11:38:31 +01:00
parent f6c1049474
commit e2d13ba7e4
9 changed files with 82 additions and 59 deletions

View File

@@ -24,7 +24,7 @@ pytest -sx 'tests/test_cameras.py::test_camera[intelrealsense-True]'
import numpy as np
import pytest
from lerobot.common.utils.robot_utils import RobotDeviceAlreadyConnectedError, RobotDeviceNotConnectedError
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
from tests.utils import TEST_CAMERA_TYPES, make_camera, require_camera
# Maximum absolute difference between two consecutive images recorded by a camera.
@@ -57,11 +57,11 @@ def test_camera(request, camera_type, mock):
camera = make_camera(**camera_kwargs)
# Test reading, async reading, disconnecting before connecting raises an error
with pytest.raises(RobotDeviceNotConnectedError):
with pytest.raises(DeviceNotConnectedError):
camera.read()
with pytest.raises(RobotDeviceNotConnectedError):
with pytest.raises(DeviceNotConnectedError):
camera.async_read()
with pytest.raises(RobotDeviceNotConnectedError):
with pytest.raises(DeviceNotConnectedError):
camera.disconnect()
# Test deleting the object without connecting first
@@ -76,7 +76,7 @@ def test_camera(request, camera_type, mock):
assert camera.height is not None
# Test connecting twice raises an error
with pytest.raises(RobotDeviceAlreadyConnectedError):
with pytest.raises(DeviceAlreadyConnectedError):
camera.connect()
# Test reading from the camera
@@ -185,9 +185,9 @@ def test_camera(request, camera_type, mock):
def test_save_images_from_cameras(tmp_path, request, camera_type, mock):
# TODO(rcadene): refactor
if camera_type == "opencv":
from lerobot.common.cameras.opencv import save_images_from_cameras
from lerobot.common.cameras.opencv.camera_opencv import save_images_from_cameras
elif camera_type == "intelrealsense":
from lerobot.common.cameras.intelrealsense import save_images_from_cameras
from lerobot.common.cameras.intel.camera_realsense import save_images_from_cameras
# Small `record_time_s` to speedup unit tests
save_images_from_cameras(tmp_path, record_time_s=0.02, mock=mock)