修复 Autocal 录像故障处理、复核回放与汇总统计

This commit is contained in:
ykcheungab
2026-10-17 12:30:15 +08:00
parent 19426c3c4a
commit 7607653c18
18 changed files with 15042 additions and 23 deletions
+33
View File
@@ -205,6 +205,39 @@ def test_the_frame_list_is_bounded_by_the_hold(tmp_path):
assert all(frame.in_video for frame in frames)
def test_confirmed_playback_uses_the_reviewers_selected_interval(tmp_path):
review = _review(tmp_path)
trial_id, step = _capture(review)
window = review["sites"][0]["windows"][1]
selected_start = window["trace"][1][0]
selected_end = window["hold_end_host_mono_ns"]
review = review_session(tmp_path / "rec", selections={f"{trial_id}:{step}": {
"t_start_host_mono_ns": selected_start,
"t_end_host_mono_ns": selected_end,
"stability_verified": True,
}})
with open_window_video(review, trial_id=trial_id, step_index=step) as player:
assert len(player.frames) == 2
assert all(selected_start <= frame.t_host_mono_ns < selected_end for frame in player.frames)
def test_playback_does_not_retain_previously_decoded_images(tmp_path):
import gc
import weakref
review = _review(tmp_path)
trial_id, step = _capture(review)
refs = []
with open_window_video(review, trial_id=trial_id, step_index=step) as player:
for index in range(player.frame_count):
image = player.frame(index)
assert image is not None
refs.append(weakref.ref(image))
del image
gc.collect()
assert sum(ref() is not None for ref in refs) <= 1
def test_decode_failure_is_reported_rather_than_showing_a_neighbour(tmp_path):
review = _review(tmp_path)
root = tmp_path / "rec"