Files
VoiceStudio/tests/whisper_cpp_fixtures.py
debpalash 2e30b1bdf3 test: isolate ASR selection and GGUF build stubs from the host (#3549)
ASR selection tests pinned only some hardware predicates, so on an Apple
Silicon or Windows ROCm host `_auto_detect` answered from the real MPS or
HIP state. A shared `neutral_asr_host` fixture now starts every predicate
False (including the lazily imported Windows HIP checks, patched on the
canonical module) and releases the warm transcription engine around the
test; the whisper.cpp fixture and the auto-detect suites use it.

The GGUF build tests wrote CRLF stubs and a Windows-form PATH under Git
Bash, so the real git/cmake could run. A shared harness writes LF files,
sets PATH inside Bash and refuses to start the script unless each
declared tool resolves to its stub.

Inspired by #3549 by @Pates2004.
2026-11-09 17:31:57 +05:30

23 lines
884 B
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):
"""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')
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)