aboutsummaryrefslogtreecommitdiff
path: root/app/tests
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-25 13:28:42 -0400
committerhistoria <historiavg@proton.me>2026-08-25 13:28:42 -0400
commitd4dbc1a158d1dd6babcba7333a4ed7d719b65d3e (patch)
treeccba2efaef9a265f7cbc754cf70d8071d09e9612 /app/tests
parent0cc01d1da0a629e104202053feb0bb0db91d578d (diff)
downloadtts-audiobook-generator-d4dbc1a158d1dd6babcba7333a4ed7d719b65d3e.tar.gz
feat: automatically name audio.cpp model ids with long name
Diffstat (limited to 'app/tests')
-rw-r--r--app/tests/test_backends_audiocpp.py38
-rw-r--r--app/tests/test_tts.py17
2 files changed, 32 insertions, 23 deletions
diff --git a/app/tests/test_backends_audiocpp.py b/app/tests/test_backends_audiocpp.py
index 2f41131..be8fead 100644
--- a/app/tests/test_backends_audiocpp.py
+++ b/app/tests/test_backends_audiocpp.py
@@ -371,20 +371,6 @@ class NormalizeDirArgTests(unittest.TestCase):
self.assertEqual(result, Path("/tmp/foo").resolve())
-class DefaultModelIdTests(unittest.TestCase):
- def test_preferred_ids_for_tested_families(self):
- self.assertEqual(make_server.default_model_id("qwen3_tts"), "qwen")
- self.assertEqual(make_server.default_model_id("higgs_audio_tts"), "higgs")
- self.assertEqual(make_server.default_model_id("voxcpm2"), "voxcpm2")
- self.assertEqual(make_server.default_model_id("index_tts2"), "indextts2")
-
- def test_derived_id_strips_trailing_tts_and_underscores(self):
- self.assertEqual(make_server.default_model_id("pocket_tts"), "pocket")
- self.assertEqual(make_server.default_model_id("dots_tts"), "dots")
- self.assertEqual(make_server.default_model_id("moss_tts_local"),
- "mossttslocal")
-
-
class LoadModelCatalogTests(unittest.TestCase):
def setUp(self):
self._td = tempfile.TemporaryDirectory()
@@ -1067,7 +1053,8 @@ class NonInteractiveMainTests(unittest.TestCase):
self.assertEqual(data["port"], make_server.config_port())
self.assertEqual(data["backend"], "cuda")
self.assertTrue(data["lazy_load"])
- self.assertEqual([m["id"] for m in data["models"]], ["higgs"])
+ self.assertEqual([m["id"] for m in data["models"]],
+ ["Higgs-Audio-v3-TTS-4B-GGUF"])
self.assertNotIn("voice_dir", data)
def test_port_sync_accepted_updates_config(self):
@@ -1098,8 +1085,9 @@ class NonInteractiveMainTests(unittest.TestCase):
exit_code = self._run(self._args("--families", "higgs_audio_tts"))
self.assertEqual(exit_code, 0)
text = self.fake_config.read_text(encoding="utf-8")
- self.assertIn('AUDIOCPP_MODEL_ID = "higgs"', text)
- self.assertIn('AUDIOCPP_CLONE_MODEL_ID = "higgs"', text)
+ self.assertIn('AUDIOCPP_MODEL_ID = "Higgs-Audio-v3-TTS-4B-GGUF"', text)
+ self.assertIn('AUDIOCPP_CLONE_MODEL_ID = "Higgs-Audio-v3-TTS-4B-GGUF"',
+ text)
def test_multi_family_lazy_with_voice_dir(self):
(self.folder / "narrator.wav").write_bytes(b"x")
@@ -1109,7 +1097,9 @@ class NonInteractiveMainTests(unittest.TestCase):
transcribe=lambda path, model_name="base": "a transcript")
self.assertEqual(exit_code, 0)
data = json.loads(self.output.read_text(encoding="utf-8"))
- self.assertEqual([m["id"] for m in data["models"]], ["qwen", "higgs"])
+ self.assertEqual([m["id"] for m in data["models"]],
+ ["Qwen3-TTS-12Hz-1.7B-Base-GGUF",
+ "Higgs-Audio-v3-TTS-4B-GGUF"])
self.assertTrue(data["lazy_load"])
self.assertEqual(data["voice_dir"], str(self.folder.resolve()))
prompt = (self.folder / make_server.PROMPT_TEXT_FILENAME).read_text(
@@ -1140,11 +1130,13 @@ class NonInteractiveMainTests(unittest.TestCase):
self.assertEqual(exit_code, 0)
data = json.loads(self.output.read_text(encoding="utf-8"))
by_id = {m["id"]: m for m in data["models"]}
- self.assertIn("qwen-design", by_id)
- self.assertEqual(by_id["qwen-design"]["task"], "vdes")
+ self.assertIn("Qwen3-TTS-12Hz-1.7B-VoiceDesign-GGUF", by_id)
+ self.assertEqual(by_id["Qwen3-TTS-12Hz-1.7B-VoiceDesign-GGUF"]["task"],
+ "vdes")
# The non-design packages are hosted with task "tts".
- self.assertTrue(any(m["id"] in ("qwen", "qwen-2") and m["task"] == "tts"
- for m in data["models"]))
+ self.assertEqual(by_id["Qwen3-TTS-12Hz-1.7B-Base-GGUF"]["task"], "tts")
+ self.assertEqual(by_id["Qwen3-TTS-12Hz-1.7B-CustomVoice-GGUF"]["task"],
+ "tts")
def test_unknown_family_rejected(self):
with self.assertRaises(SystemExit) as ctx:
@@ -1765,7 +1757,7 @@ class WizardNavigationTests(unittest.TestCase):
self.assertEqual(len(tree_calls), 2)
self.assertEqual(settings["host"], "127.0.0.1")
self.assertEqual([m["id"] for m in settings["model_entries"]],
- ["supertonic"])
+ ["Supertonic-GGUF"])
class UninstallTests(unittest.TestCase):
diff --git a/app/tests/test_tts.py b/app/tests/test_tts.py
index 77f0ee8..b43919d 100644
--- a/app/tests/test_tts.py
+++ b/app/tests/test_tts.py
@@ -477,6 +477,13 @@ class QwenTTSClientGenerateTests(unittest.TestCase):
class AudioCppTTSClientHealthTests(unittest.TestCase):
"""Connection behavior of the audio.cpp client."""
+ def setUp(self):
+ # The default AUDIOCPP_MODEL_ID is empty (auto-select); these tests
+ # exercise a configured single-model server, so pin a concrete id.
+ patcher = patch.object(config, "AUDIOCPP_MODEL_ID", "qwen")
+ patcher.start()
+ self.addCleanup(patcher.stop)
+
@staticmethod
def _json_response(payload):
response = MagicMock()
@@ -670,6 +677,11 @@ class AudioCppTTSClientHealthTests(unittest.TestCase):
class AudioCppTaskDetectionTests(unittest.TestCase):
"""Task auto-detection (tts/clon/vdes) and voice design validation."""
+ def setUp(self):
+ patcher = patch.object(config, "AUDIOCPP_MODEL_ID", "qwen")
+ patcher.start()
+ self.addCleanup(patcher.stop)
+
@staticmethod
def _json_response(payload):
response = MagicMock()
@@ -808,6 +820,11 @@ class AudioCppTaskDetectionTests(unittest.TestCase):
class AudioCppFamilyDetectionTests(unittest.TestCase):
"""Family auto-detection and per-family adaptations."""
+ def setUp(self):
+ patcher = patch.object(config, "AUDIOCPP_MODEL_ID", "qwen")
+ patcher.start()
+ self.addCleanup(patcher.stop)
+
@staticmethod
def _json_response(payload):
response = MagicMock()