added calibration data handling functions
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
"""Tests for sensor-bundle export helpers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from orisys.configs import (
|
||||
export_sensor_bundle,
|
||||
export_sensor_bundles,
|
||||
list_sensor_bundles,
|
||||
resolve_sensor_bundle,
|
||||
)
|
||||
|
||||
|
||||
def test_export_sensor_bundle_json_only(tmp_path: Path) -> None:
|
||||
assert resolve_sensor_bundle("box") is not None
|
||||
|
||||
dest = export_sensor_bundle("box", tmp_path, include_assets=False)
|
||||
assert dest == tmp_path / "box"
|
||||
assert (dest / "sensor.json").is_file()
|
||||
assert (dest / "force_calibration.json").is_file()
|
||||
assert not (dest / "assets").exists()
|
||||
|
||||
|
||||
def test_export_sensor_bundles_default_names(tmp_path: Path) -> None:
|
||||
available = list_sensor_bundles()
|
||||
assert "box" in available
|
||||
|
||||
exported = export_sensor_bundles(tmp_path, include_assets=False)
|
||||
names = {path.name for path in exported}
|
||||
assert "box" in names
|
||||
assert "mini" in names
|
||||
for path in exported:
|
||||
assert (path / "sensor.json").is_file()
|
||||
assert not (path / "assets").exists()
|
||||
|
||||
|
||||
def test_export_sensor_bundle_no_overwrite(tmp_path: Path) -> None:
|
||||
export_sensor_bundle("box", tmp_path, overwrite=True)
|
||||
with pytest.raises(FileExistsError):
|
||||
export_sensor_bundle("box", tmp_path, overwrite=False)
|
||||
|
||||
|
||||
def test_export_sensor_bundle_missing_name(tmp_path: Path) -> None:
|
||||
with pytest.raises(FileNotFoundError):
|
||||
export_sensor_bundle("not-a-real-sensor", tmp_path)
|
||||
Reference in New Issue
Block a user