MCPcopy
hub / github.com/roboflow/supervision / test_process_video_exception_handling

Function test_process_video_exception_handling

tests/utils/test_video.py:29–49  ·  view source on GitHub ↗

Verify that process_video correctly propagates exceptions from the callback. Scenario: Processing a video where the callback raises an exception. Expected: `process_video` should propagate the exception, allowing users to handle errors during video processing.

(dummy_video_path, tmp_path)

Source from the content-addressed store, hash-verified

27
28
29def test_process_video_exception_handling(dummy_video_path, tmp_path):
30 """
31 Verify that process_video correctly propagates exceptions from the callback.
32
33 Scenario: Processing a video where the callback raises an exception.
34 Expected: `process_video` should propagate the exception, allowing users to
35 handle errors during video processing.
36 """
37 target_path = str(tmp_path / "target.mp4")
38
39 def callback_with_exception(frame, index):
40 if index == 5:
41 raise ValueError("Test exception at frame 5")
42 return frame
43
44 with pytest.raises(ValueError, match="Test exception at frame 5"):
45 process_video(
46 source_path=dummy_video_path,
47 target_path=target_path,
48 callback=callback_with_exception,
49 )
50
51
52def test_process_video_success(dummy_video_path, tmp_path):

Callers

nothing calls this directly

Calls 1

process_videoFunction · 0.90

Tested by

no test coverage detected