feat: closes #2,#3,#4 — scripts pre_decimate + archive_job + check_jobs + tests

This commit is contained in:
Floppyrj45
2026-04-25 18:23:18 +02:00
parent 74edb36471
commit 48e9d42260
6 changed files with 267 additions and 0 deletions

54
tests/test_check_jobs.py Normal file
View File

@@ -0,0 +1,54 @@
import tempfile
from pathlib import Path
def _make_job_dir(base: Path, job_id: int, has_ply: bool = True, has_poses: bool = True) -> Path:
job_dir = base / f"job_{job_id}"
job_dir.mkdir(parents=True)
if has_ply:
(job_dir / "reconstruction.ply").write_bytes(b"\x00" * 100)
if has_poses:
(job_dir / "lingbot_poses.npz").touch()
return job_dir
def test_complete_job_is_ok():
from scripts.check_jobs import check_job
with tempfile.TemporaryDirectory() as tmp:
_make_job_dir(Path(tmp), 1)
result = check_job(1, tmp)
assert result["status"] == "ok"
assert result["job_id"] == 1
assert result["missing"] == []
def test_missing_ply_flagged():
from scripts.check_jobs import check_job
with tempfile.TemporaryDirectory() as tmp:
_make_job_dir(Path(tmp), 2, has_ply=False)
result = check_job(2, tmp)
assert result["status"] == "incomplete"
assert "reconstruction.ply" in result["missing"]
def test_missing_poses_flagged():
from scripts.check_jobs import check_job
with tempfile.TemporaryDirectory() as tmp:
_make_job_dir(Path(tmp), 3, has_poses=False)
result = check_job(3, tmp)
assert result["status"] == "incomplete"
assert "lingbot_poses.npz" in result["missing"]
def test_missing_job_dir_returns_missing():
from scripts.check_jobs import check_job
result = check_job(999, "/nonexistent/base")
assert result["status"] == "missing"
def test_decimated_flag_false_without_file():
from scripts.check_jobs import check_job
with tempfile.TemporaryDirectory() as tmp:
_make_job_dir(Path(tmp), 4)
result = check_job(4, tmp)
assert result["details"]["decimated"] is False