Files
VoiceStudio/tests/whisper_cpp_fixtures.py
Palash Debnath 816e64ae0f fix(asr): share duration-aware whole-file transcription deadlines (#4112)
Scale whole-file transcription deadlines with recording duration across uploads, streaming dubbing, child engines and MCP waits. Keep queueing and setup inside the same deadline, and preserve physical worker and upload ownership when work is cancelled.

Cover long recordings, child-process ceilings, fallback deadlines, finite settings, queued metadata, late model loading and cancellation cleanup with regression tests. Update engine and troubleshooting documentation.
2026-11-14 16:20:53 +05:30

26 lines
1.1 KiB
Python

"""Resolve test seams after other suites isolate backend modules."""
import importlib
from types import SimpleNamespace
import pytest
@pytest.fixture
def m(neutral_asr_host, monkeypatch):
"""Backend seams on a CPU-only host: a test opts in to its hardware (#3549)."""
bootstrap = importlib.import_module('engines.whisper_cpp.bootstrap')
backend = importlib.import_module('engines.whisper_cpp.backend')
# Most CLI fixtures use deliberately invalid audio and mock subprocess.run.
# Duration probing has its own real-media coverage and must not hit that mock.
monkeypatch.setattr('services.ffmpeg_utils.probe_audio_duration', lambda path: None)
namespace = {
'wc': backend,
'WhisperCppBackend': backend.WhisperCppBackend,
'ab': importlib.import_module('services.asr_backend'),
'HostCaps': importlib.import_module('core.device_caps').HostCaps,
}
for name in ('BACKEND_ENV', 'BIN_ENV', 'DEVICE_ENV', 'DIR_ENV', 'MODEL_ENV',
'is_installed', 'locate_binary', 'resolve_model'):
namespace[name] = getattr(bootstrap, name)
return SimpleNamespace(**namespace)