diff options
| author | historia <historiavg@proton.me> | 2026-08-28 14:57:48 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-28 14:57:48 -0400 |
| commit | db38085d07ce75f8961eecdc1919e98748254c53 (patch) | |
| tree | beaea2ba84de05bfc2fa90e9b92a24568d3b4cb9 /app/tests/test_backends.py | |
| parent | afb2c2d5b297c5aa28bcced0e3f90e207d799c2a (diff) | |
| download | tts-audiobook-generator-db38085d07ce75f8961eecdc1919e98748254c53.tar.gz | |
refactor: overhaul config.py, remove cli default options
Diffstat (limited to 'app/tests/test_backends.py')
| -rw-r--r-- | app/tests/test_backends.py | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/app/tests/test_backends.py b/app/tests/test_backends.py index 09ad3cc..64fd483 100644 --- a/app/tests/test_backends.py +++ b/app/tests/test_backends.py @@ -145,31 +145,33 @@ class DetectAllTests(unittest.TestCase): self.assertEqual(status.remote_models, [model]) self.assertEqual(status.running_models, [model]) - def test_qwen_detect_uses_one_spec_for_the_configured_model(self): - # One demo server hosts one model on the single port: the spec's - # argv launches config.QWEN_MODEL's repo, and its identity matches. + def test_qwen_detect_builds_one_spec_for_the_default_model(self): + # One demo server hosts one model on the single port: the detect() + # spec launches the default model's repo (CustomVoice), and its + # identity matches; runs wanting another model boot their own spec. from backends import qwen from backends.probe import (IDENTITY_QWEN_CLONE, IDENTITY_QWEN_CUSTOM, IDENTITY_QWEN_DESIGN) - cases = {"CustomVoice": IDENTITY_QWEN_CUSTOM, - "Base": IDENTITY_QWEN_CLONE, - "VoiceDesign": IDENTITY_QWEN_DESIGN} - for model, identity in cases.items(): + identity = IDENTITY_QWEN_CUSTOM + model = qwen.DEFAULT_MODEL + with patch.object(qwen, "_is_installed", return_value=True), \ + patch("backends.common.server_running", + return_value=False): + status = qwen.detect() + self.assertEqual([spec.name for spec in status.servers], ["qwen"]) + spec = status.servers[0] + self.assertEqual(spec.identity, identity) + self.assertIn(qwen.MODEL_REPOS[model], spec.argv) + self.assertIn(qwen.MODEL_REPOS[model], status.launch_hint) + + # An explicit per-run spec can target any of the three models. + for model, wanted in (("Base", IDENTITY_QWEN_CLONE), + ("VoiceDesign", IDENTITY_QWEN_DESIGN)): with self.subTest(model=model): - with patch.object(qwen.config, "QWEN_MODEL", model), \ - patch.object(qwen, "_is_installed", - return_value=True), \ - patch("backends.common.server_running", - return_value=False): - status = qwen.detect() - self.assertEqual([spec.name for spec in status.servers], - ["qwen"]) - spec = status.servers[0] - self.assertEqual(spec.identity, identity) + spec = qwen._build_spec(model) + self.assertEqual(spec.identity, wanted) self.assertIn(qwen.MODEL_REPOS[model], spec.argv) - self.assertIn(qwen.MODEL_REPOS[model], - status.launch_hint) def test_qwen_detect_marks_our_server_as_managed(self): from backends import qwen |
