feat: add tool-call fallback and resilient batch exports
This commit is contained in:
1 parent
ab066733b8
commit
d31eb2a19d
32 files changed
+538
-72
No files matched your search
@@ -318,6 +318,38 @@ async def test_fail_fast_includes_skipped_reports(isolated, monkeypatch):
|
||||
assert sum(n.endswith(".docx") for n in z.namelist()) == 3
|
||||
|
||||
|
||||
def test_batch_archive_contains_each_task_media_when_present(isolated, monkeypatch, tmp_path):
|
||||
batch = service.create_batch(payload())
|
||||
first, second = isolated.jobs(batch["id"])
|
||||
image1 = tmp_path / "first.png"
|
||||
image2 = tmp_path / "second.png"
|
||||
video = tmp_path / "recording.mp4"
|
||||
image1.write_bytes(b"first screenshot")
|
||||
image2.write_bytes(b"second screenshot")
|
||||
video.write_bytes(b"saved recording")
|
||||
images = {first["session_id"]: image1, second["session_id"]: image2}
|
||||
monkeypatch.setattr(
|
||||
reports,
|
||||
"session_screenshots",
|
||||
lambda report: [(images[report["id"]], "0001_步骤0001_操作前.png")],
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
reports,
|
||||
"session_videos",
|
||||
lambda report: (
|
||||
[(video, "0001_recording.mp4")] if report["id"] == first["session_id"] else []
|
||||
),
|
||||
)
|
||||
|
||||
archive = reports.export_batch(batch["id"])
|
||||
with zipfile.ZipFile(archive) as z:
|
||||
names = z.namelist()
|
||||
assert len([name for name in names if "/步骤截图/" in name]) == 2
|
||||
assert len([name for name in names if "/任务录屏/" in name]) == 1
|
||||
assert all(name.startswith("任务报告/") for name in names if "步骤截图" in name)
|
||||
assert z.read(next(name for name in names if "/任务录屏/" in name)) == b"saved recording"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_report_failure_does_not_strand_job(isolated, monkeypatch):
|
||||
job = isolated.jobs(service.create_batch(payload())["id"])[0]
|
||||
|
||||
Reference in new issue
Block a user