Upload 13 files
Browse files- tests/test_custom_ui_shell.py +2 -2
- tests/test_progress.py +7 -0
- tests/test_run_bundle_details.py +39 -0
tests/test_custom_ui_shell.py
CHANGED
|
@@ -22,8 +22,8 @@ def test_custom_ui_contains_core_product_sections():
|
|
| 22 |
root = Path(__file__).resolve().parents[1]
|
| 23 |
html = (root / "web" / "index.html").read_text()
|
| 24 |
for text in [
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
"Run Explorer",
|
| 28 |
"Run storage",
|
| 29 |
"Live job progress",
|
|
|
|
| 22 |
root = Path(__file__).resolve().parents[1]
|
| 23 |
html = (root / "web" / "index.html").read_text()
|
| 24 |
for text in [
|
| 25 |
+
"New Build",
|
| 26 |
+
"Space Test",
|
| 27 |
"Run Explorer",
|
| 28 |
"Run storage",
|
| 29 |
"Live job progress",
|
tests/test_progress.py
CHANGED
|
@@ -24,3 +24,10 @@ def test_progress_from_events_marks_done():
|
|
| 24 |
assert result["progress"] == 100
|
| 25 |
assert result["status"] == "full_inference_success"
|
| 26 |
assert all(step["status"] == "done" for step in result["timeline"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
assert result["progress"] == 100
|
| 25 |
assert result["status"] == "full_inference_success"
|
| 26 |
assert all(step["status"] == "done" for step in result["timeline"])
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_progress_uses_launch_state_when_events_not_ready():
|
| 30 |
+
result = progress_from_events([], state={"status": "running", "created_at": "2026-06-02T10:00:00+00:00"})
|
| 31 |
+
assert result["status"] == "running"
|
| 32 |
+
assert result["progress"] >= 0
|
| 33 |
+
assert result["current_step"] == "job_launched"
|
tests/test_run_bundle_details.py
CHANGED
|
@@ -21,3 +21,42 @@ def test_summarize_run_bundle_uses_gate_and_smoke():
|
|
| 21 |
assert summary["health_passed"] is True
|
| 22 |
assert summary["smoke_test_passed"] is True
|
| 23 |
assert summary["latency_seconds"] == 18.7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
assert summary["health_passed"] is True
|
| 22 |
assert summary["smoke_test_passed"] is True
|
| 23 |
assert summary["latency_seconds"] == 18.7
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def test_summarize_run_bundle_recovers_launch_only_running_job():
|
| 27 |
+
bundle = {
|
| 28 |
+
"launch": {
|
| 29 |
+
"kind": "universal_model_card_builder",
|
| 30 |
+
"status": "running",
|
| 31 |
+
"model_id": "Tongyi-MAI/Z-Image-Turbo",
|
| 32 |
+
"target_space": "alice/z-image",
|
| 33 |
+
"job_id": "abc123",
|
| 34 |
+
"job_url": "https://huggingface.co/jobs/alice/abc123",
|
| 35 |
+
"created_by": "alice",
|
| 36 |
+
"preferred_space_hardware": "zero-a10g",
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
summary = summarize_run_bundle("run-launch", bundle, bucket_source="alice/space-factory-runs")
|
| 40 |
+
assert summary["status"] == "running"
|
| 41 |
+
assert summary["model_id"] == "Tongyi-MAI/Z-Image-Turbo"
|
| 42 |
+
assert summary["target_space"] == "alice/z-image"
|
| 43 |
+
assert summary["job_id"] == "abc123"
|
| 44 |
+
assert summary["job_url"].endswith("/abc123")
|
| 45 |
+
assert summary["artifacts_url"].endswith("/tree/main/runs/run-launch")
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def test_summarize_run_bundle_uses_summary_file_fallback():
|
| 49 |
+
bundle = {
|
| 50 |
+
"summary_file": {
|
| 51 |
+
"status": "running",
|
| 52 |
+
"model_id": "owner/model",
|
| 53 |
+
"target_space": "alice/generated-space",
|
| 54 |
+
"job_id": "job-from-summary",
|
| 55 |
+
"job_url": "https://huggingface.co/jobs/alice/job-from-summary",
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
summary = summarize_run_bundle("run-summary", bundle, bucket_source="alice/space-factory-runs")
|
| 59 |
+
assert summary["status"] == "running"
|
| 60 |
+
assert summary["model_id"] == "owner/model"
|
| 61 |
+
assert summary["job_id"] == "job-from-summary"
|
| 62 |
+
assert summary["target_space_url"].endswith("/alice/generated-space")
|