"""Tests for workspace iteration-directory resolution (no model calls).""" from pathlib import Path from skill_eval_runner.workspace import resolve_iteration def test_resolve_iteration_starts_at_one(tmp_path: Path) -> None: """An empty workspace yields iteration-1.""" assert resolve_iteration(tmp_path, None).name == "iteration-1" def test_resolve_iteration_auto_increments(tmp_path: Path) -> None: """The next iteration is one past the highest existing numbered dir.""" (tmp_path / "iteration-1").mkdir() (tmp_path / "iteration-2").mkdir() assert resolve_iteration(tmp_path, None).name == "iteration-3" def test_resolve_iteration_ignores_non_numeric_entries(tmp_path: Path) -> None: """A nonconforming `iteration-*` entry doesn't crash the increment logic.""" (tmp_path / "iteration-1").mkdir() (tmp_path / "iteration-old").mkdir() assert resolve_iteration(tmp_path, None).name == "iteration-2" def test_resolve_iteration_honors_forced_number(tmp_path: Path) -> None: """A forced iteration number is used verbatim and is idempotent.""" assert resolve_iteration(tmp_path, 7).name == "iteration-7" assert resolve_iteration(tmp_path, 7).name == "iteration-7"