fix: set proper mock_info attributes in SSE streaming tests

MagicMock auto-attributes are not JSON serializable. Set language,
language_probability, and duration explicitly. Also exclude metadata
events from segment count assertion.
This commit is contained in:
Aaron Boxer
2026-04-17 12:04:02 -04:00
committed by Aaron Boxer
parent 8ac98dceec
commit 8396763444
2 changed files with 9 additions and 5 deletions
-3
View File
@@ -505,11 +505,8 @@ class TranscriptionServer:
yield f"data: {json.dumps(seg_dict)}\n\n"
yield "data: [DONE]\n\n"
wl_metrics.track_rest_request(endpoint="transcriptions_stream", status=200)
except Exception as e:
yield f"data: {json.dumps({'error': str(e)})}\n\n"
wl_metrics.track_rest_request(endpoint="transcriptions_stream", status=500)
wl_metrics.track_error("rest_stream")
finally:
if tmp_path and os.path.exists(tmp_path):
os.unlink(tmp_path)