|
1 | 1 | """Comprehensive tests for validation.py""" |
2 | 2 | import pytest |
3 | 3 | from validation import ( |
| 4 | + ChangelogEntry, |
4 | 5 | Fields, |
5 | 6 | SingleNodeMatrixEntry, |
6 | 7 | SingleNodeAgenticMatrixEntry, |
@@ -932,3 +933,44 @@ def test_validation_runs_by_default(self, tmp_path): |
932 | 933 | with pytest.raises(ValueError) as exc_info: |
933 | 934 | load_runner_file(str(runner_file)) |
934 | 935 | assert "must be a list" in str(exc_info.value) |
| 936 | + |
| 937 | + |
| 938 | +class TestChangelogEntry: |
| 939 | + """Tests for ChangelogEntry, incl. the benchmarks-only / evals-only options.""" |
| 940 | + |
| 941 | + def _base(self, **extra): |
| 942 | + entry = { |
| 943 | + "config-keys": ["minimaxm2.5-fp4-b200-vllm"], |
| 944 | + "description": ["re-run for power capture"], |
| 945 | + "pr-link": "https://github.com/SemiAnalysisAI/InferenceX/pull/1666", |
| 946 | + } |
| 947 | + entry.update(extra) |
| 948 | + return entry |
| 949 | + |
| 950 | + def test_defaults(self): |
| 951 | + """Both opt-out flags default to False.""" |
| 952 | + entry = ChangelogEntry.model_validate(self._base()) |
| 953 | + assert entry.evals_only is False |
| 954 | + assert entry.benchmarks_only is False |
| 955 | + |
| 956 | + def test_benchmarks_only_alias(self): |
| 957 | + """benchmarks-only YAML key maps to benchmarks_only.""" |
| 958 | + entry = ChangelogEntry.model_validate(self._base(**{"benchmarks-only": True})) |
| 959 | + assert entry.benchmarks_only is True |
| 960 | + |
| 961 | + def test_evals_only_alias(self): |
| 962 | + entry = ChangelogEntry.model_validate(self._base(**{"evals-only": True})) |
| 963 | + assert entry.evals_only is True |
| 964 | + |
| 965 | + def test_evals_and_benchmarks_only_mutually_exclusive(self): |
| 966 | + """Setting both opt-out flags is rejected.""" |
| 967 | + with pytest.raises(ValueError) as exc_info: |
| 968 | + ChangelogEntry.model_validate( |
| 969 | + self._base(**{"evals-only": True, "benchmarks-only": True}) |
| 970 | + ) |
| 971 | + assert "mutually exclusive" in str(exc_info.value) |
| 972 | + |
| 973 | + def test_unknown_field_forbidden(self): |
| 974 | + """extra='forbid' rejects typos like a singular 'benchmark-only'.""" |
| 975 | + with pytest.raises(ValueError): |
| 976 | + ChangelogEntry.model_validate(self._base(**{"benchmark-only": True})) |
0 commit comments