From 919544c0931d53bb81904b6212ff14f856549da3 Mon Sep 17 00:00:00 2001 From: historia Date: Mon, 24 Aug 2026 16:18:38 -0400 Subject: feat: option to unload models from audio.cpp per-run --- app/tests/test_tts.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'app/tests/test_tts.py') 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.""" -- cgit v1.2.3