[Perf][CI] Reuse the Whisper judge worker across a test module (#6208)

Signed-off-by: Shenglei Fu <sfu@confluent.io>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
Shenglei FuandHongsheng Liu authored and GitHub committed 2026-08-20 10:49:44 +08:00
1 parent bd17618c11
commit 47b1893676
6 files changed
+428 -60

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
"""Fixtures for the reused Whisper transcription worker."""
import sys
import pytest
@pytest.fixture(autouse=True, scope="module")
def release_audio_transcriber_after_module():
"""Free the transcription worker's device memory once a test module is done.
A backstop. The server and runner fixtures already release the worker when
each of their instances tears down, which is what keeps Whisper off the
device while the next parametrized server initializes. This covers the
remaining case: a module that transcribes without using those fixtures.
Reached through ``sys.modules`` because ``tests/conftest.py`` deliberately
keeps ``tests.helpers.media`` lazy: a module that never transcribed should
not pay to import it.
"""
yield
media = sys.modules.get("tests.helpers.media")
if media is not None:
media.release_audio_transcriber()