mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 05:40:26 +02:00
refactor: remove compatibility layer, use Plugin Architecture directly
- Delete abogen/tts_plugin/compat.py (CompatBackend, create_backend, get_metadata, etc.) - Add abogen/tts_plugin/utils.py with direct Plugin Manager functions: get_voices, get_default_voice, is_plugin_registered, resolve_voice_to_plugin, create_pipeline - Update all 16 consumer files to import from utils instead of compat - Update __init__.py to re-export utils instead of compat - Update 5 test files and add TestNoCompatLayer regression tests - All 493 tests pass
This commit is contained in:
@@ -30,16 +30,16 @@ def test_preview_applies_manual_override_before_normalization(monkeypatch):
|
||||
captured["text"] = text
|
||||
return iter(())
|
||||
|
||||
from abogen.tts_plugin import compat
|
||||
from abogen.tts_plugin import utils
|
||||
|
||||
original_create_backend = compat.create_backend
|
||||
original_create_pipeline = utils.create_pipeline
|
||||
|
||||
def _mock_create_backend(backend_id, **kwargs):
|
||||
def _mock_create_pipeline(backend_id, **kwargs):
|
||||
if backend_id == "supertonic":
|
||||
return DummyPipeline(**kwargs)
|
||||
return original_create_backend(backend_id, **kwargs)
|
||||
return original_create_pipeline(backend_id, **kwargs)
|
||||
|
||||
monkeypatch.setattr(compat, "create_backend", _mock_create_backend)
|
||||
monkeypatch.setattr(utils, "create_pipeline", _mock_create_pipeline)
|
||||
|
||||
try:
|
||||
preview.generate_preview_audio(
|
||||
|
||||
Reference in New Issue
Block a user