SPerva commited on
Commit
3056f95
·
verified ·
1 Parent(s): e6877b5

Sync Space from GitHub 698a7ac548e2c8414525dfb0c58acd8c6755a0bd

Browse files
tests/eval/test_run_benchmark.py CHANGED
@@ -366,6 +366,13 @@ def test_manifest_includes_ddinter_release_metadata():
366
  assert manifest["concurrency"] == 8
367
 
368
 
 
 
 
 
 
 
 
369
  @pytest.mark.asyncio
370
  async def test_ensure_ddinter_db_downloads_from_github_release(monkeypatch, tmp_path: Path):
371
  checks = iter([False, True])
 
366
  assert manifest["concurrency"] == 8
367
 
368
 
369
+ def test_git_commit_uses_benchmark_env_when_git_metadata_missing(monkeypatch):
370
+ monkeypatch.setenv("BENCHMARK_GIT_COMMIT", "e9f24645baf2d64a0504ee5b03c7af9f767b74cb")
371
+ monkeypatch.setattr(run_benchmark.subprocess, "run", lambda *args, **kwargs: (_ for _ in ()).throw(RuntimeError))
372
+
373
+ assert run_benchmark._git_commit() == "e9f24645baf2d64a0504ee5b03c7af9f767b74cb"
374
+
375
+
376
  @pytest.mark.asyncio
377
  async def test_ensure_ddinter_db_downloads_from_github_release(monkeypatch, tmp_path: Path):
378
  checks = iter([False, True])
tests/test_tier1_benchmark_workflow.py CHANGED
@@ -29,6 +29,7 @@ def test_tier1_benchmark_workflow_contract():
29
  assert "INTERACTION_DB_TAG" in workflow
30
  assert "INTERACTION_DB_SHA256" in workflow
31
  assert "BENCHMARK_FORCE_OS_EXIT=1" in workflow
 
32
  assert 'tr -d "\\r\\n"' in workflow
33
  assert 'INTERACTION_DB_REPO="$(printf' in workflow
34
  assert 'INTERACTION_DB_TAG="$(printf' in workflow
@@ -36,6 +37,7 @@ def test_tier1_benchmark_workflow_contract():
36
  assert "hf://buckets/SPerva/pillchecker-experiments" in workflow
37
  assert 'bucket = os.environ["BENCHMARK_BUCKET"]' in workflow
38
  assert "0 < sample_size <= expected_limit" in workflow
 
39
  assert "len(predictions) == sample_size" in workflow
40
 
41
  for artifact in ("manifest.json", "results.json", "predictions.jsonl", "errors.jsonl", "summary.md"):
 
29
  assert "INTERACTION_DB_TAG" in workflow
30
  assert "INTERACTION_DB_SHA256" in workflow
31
  assert "BENCHMARK_FORCE_OS_EXIT=1" in workflow
32
+ assert "BENCHMARK_GIT_COMMIT=${GITHUB_SHA}" in workflow
33
  assert 'tr -d "\\r\\n"' in workflow
34
  assert 'INTERACTION_DB_REPO="$(printf' in workflow
35
  assert 'INTERACTION_DB_TAG="$(printf' in workflow
 
37
  assert "hf://buckets/SPerva/pillchecker-experiments" in workflow
38
  assert 'bucket = os.environ["BENCHMARK_BUCKET"]' in workflow
39
  assert "0 < sample_size <= expected_limit" in workflow
40
+ assert 'manifest.get("git_commit") not in ("", "0000000", None)' in workflow
41
  assert "len(predictions) == sample_size" in workflow
42
 
43
  for artifact in ("manifest.json", "results.json", "predictions.jsonl", "errors.jsonl", "summary.md"):