aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_tts.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-24 16:18:38 -0400
committerhistoria <historiavg@proton.me>2026-08-24 16:18:38 -0400
commit919544c0931d53bb81904b6212ff14f856549da3 (patch)
treeaef7161db4cdb43bbd572fdc6c2fa2539726f4ee /app/tests/test_tts.py
parent1ff9a635bd9b033b631a6b525891b7eb44e189d3 (diff)
downloadtts-audiobook-generator-919544c0931d53bb81904b6212ff14f856549da3.tar.gz
feat: option to unload models from audio.cpp per-run
Diffstat (limited to 'app/tests/test_tts.py')
-rw-r--r--app/tests/test_tts.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/tests/test_tts.py b/app/tests/test_tts.py
index 0026702..77f0ee8 100644
--- a/app/tests/test_tts.py
+++ b/app/tests/test_tts.py
@@ -1394,6 +1394,36 @@ class AudioCppUnloadModelsTests(unittest.TestCase):
client._connect()
mock_unload.assert_called_once()
+ def test_connect_skips_unload_when_disabled(self):
+ client = AudioCppTTSClient.__new__(AudioCppTTSClient)
+ client.api_url = "http://127.0.0.1:8080"
+ client.model_id = config.AUDIOCPP_MODEL_ID
+ client.preset_mode = True
+ client.voice = "narrator"
+ client.language = "English"
+ client._seed = -1
+ client.family = "qwen3_tts"
+ client.task = tts.AUDIOCPP_TASK_TTS
+ client.profile = tts.AUDIOCPP_FAMILY_PROFILES["qwen3_tts"]
+ client.design_mode = False
+ client.instruction_voice = False
+ client.instructions = ""
+ with patch.object(client, "_check_health"), \
+ patch.object(client, "_list_models",
+ return_value=[{"id": client.model_id,
+ "family": "qwen3_tts",
+ "task": "tts"}]), \
+ patch.object(client, "_auto_pick_model_id"), \
+ patch.object(client, "_select_model"), \
+ patch.object(client, "_require_model_id"), \
+ patch.object(client, "_resolve_family"), \
+ patch.object(client, "_resolve_task"), \
+ patch.object(client, "_check_voice"), \
+ patch.object(tts.config, "AUDIOCPP_UNLOAD_MODELS", False), \
+ patch.object(client, "_unload_server_models") as mock_unload:
+ client._connect()
+ mock_unload.assert_not_called()
+
class BackendWiringTests(unittest.TestCase):
"""AudiobookConverter wiring for the --backend selector."""