"""Tests for suite-config discovery and resolution.""" from pathlib import Path from skill_eval_runner.config import load_config def test_defaults_when_no_config(tmp_path: Path) -> None: """With no config file, the conventional layout is assumed.""" config = load_config(tmp_path) assert config.skill_file == (tmp_path / "SKILL.md").resolve() assert config.suite == (tmp_path / "evals/evals.json").resolve() assert config.file_root == tmp_path.resolve() assert config.artifact.mode == "tool" assert config.artifact.tool_name == "write_report" def test_loads_skill_eval_toml(tmp_path: Path) -> None: """skill-eval.toml overrides paths, artifact, and models.""" (tmp_path / "skill-eval.toml").write_text( "[skill_eval]\n" 'skill_file = "S.md"\n' 'suite = "e/evals.json"\n' "[skill_eval.artifact]\n" 'mode = "final_message"\n' "[skill_eval.models]\n" 'small = "haiku"\n' ) config = load_config(tmp_path) assert config.skill_file == (tmp_path / "S.md").resolve() assert config.suite == (tmp_path / "e/evals.json").resolve() assert config.artifact.mode == "final_message" assert config.models.small == "haiku" def test_discovers_config_walking_up(tmp_path: Path) -> None: """Discovery walks up from a nested start directory to the config root.""" (tmp_path / "skill-eval.toml").write_text('[skill_eval]\nskill_file = "S.md"\n') nested = tmp_path / "a" / "b" nested.mkdir(parents=True) config = load_config(nested) assert config.root == tmp_path.resolve()