Files
openrun/tests/unit/test_model.py

26 lines
753 B
Python
Raw Normal View History

2026-05-19 08:34:22 -04:00
"""Tests for pure helpers in `openrun.model`."""
from __future__ import annotations
from pathlib import Path
import pytest
from openrun.model import _resolve_fit_path
def test_resolve_fit_path_returns_existing_absolute_path(tmp_path: Path) -> None:
fit = tmp_path / "sub" / "run.fit"
fit.parent.mkdir(parents=True)
fit.write_bytes(b"")
assert _resolve_fit_path(str(fit)) == fit
def test_resolve_fit_path_missing_raises_with_relink_hint(tmp_path: Path) -> None:
missing = tmp_path / "gone.fit"
with pytest.raises(FileNotFoundError) as exc_info:
_resolve_fit_path(str(missing))
msg = str(exc_info.value)
assert "--relink" in msg, f"expected hint about --relink, got: {msg!r}"
assert str(missing) in msg