aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_backends_audiocpp.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-25 19:03:09 -0400
committerhistoria <historiavg@proton.me>2026-08-25 19:03:09 -0400
commit8c9a782dfe94525dc5f0893c98fd19543648264b (patch)
treefdff70d967ef06f0da560ca284842427cbe647a8 /app/tests/test_backends_audiocpp.py
parent64e9940d43fad1bc5908b39673b03e4fdc1e8f2f (diff)
downloadtts-audiobook-generator-8c9a782dfe94525dc5f0893c98fd19543648264b.tar.gz
fix: tui errors wait for getch()
Diffstat (limited to 'app/tests/test_backends_audiocpp.py')
-rw-r--r--app/tests/test_backends_audiocpp.py39
1 files changed, 12 insertions, 27 deletions
diff --git a/app/tests/test_backends_audiocpp.py b/app/tests/test_backends_audiocpp.py
index 665dbf0..3063e99 100644
--- a/app/tests/test_backends_audiocpp.py
+++ b/app/tests/test_backends_audiocpp.py
@@ -1895,7 +1895,6 @@ class SetupScreenTests(unittest.TestCase):
self.assertEqual(rc, 0)
mk_lanes.assert_called_once()
self.assertIs(mk_lanes.call_args[0][0], settings)
- self.assertTrue(mk_lanes.call_args[1]["parallel"])
mk_run.assert_called_once()
self.assertEqual(mk_run.call_args[0][2], lanes)
@@ -1956,48 +1955,34 @@ class ExecuteLanesTests(unittest.TestCase):
"Write server.json & sync config",
"Download models"])
- def test_download_step_prints_the_parallel_launch_hint(self):
- args = make_server.build_parser().parse_args([])
- lanes = make_server._execute_lanes(self._settings(), args,
- parallel=True)
- install_step = lanes[1].steps[2]
- with patch.object(make_server, "_install_models") as mk_install, \
- patch.object(make_server, "_print_launch_hint") as mk_hint:
- install_step.work(lambda line: None, threading.Event())
- mk_hint.assert_called_once()
- self.assertTrue(mk_hint.call_args[1]["pending_build"])
-
- def test_download_step_console_hint_is_not_pending(self):
+ def test_download_step_prints_the_launch_hint(self):
args = make_server.build_parser().parse_args([])
lanes = make_server._execute_lanes(self._settings(), args)
install_step = lanes[1].steps[2]
- with patch.object(make_server, "_install_models") as mk_install, \
+ with patch.object(make_server, "_install_models"), \
patch.object(make_server, "_print_launch_hint") as mk_hint:
install_step.work(lambda line: None, threading.Event())
- mk_hint.assert_called_once()
- self.assertFalse(mk_hint.call_args[1]["pending_build"])
+ mk_hint.assert_called_once_with(Path("/x"), Path("/x/server.json"))
class LaunchHintTests(unittest.TestCase):
- """_print_launch_hint: exact command vs. the pending-build message."""
+ """_print_launch_hint: silent when built, remediation when not."""
- def _capture(self, audiocpp_dir, output_path, pending_build=False):
+ def _capture(self, audiocpp_dir, output_path, binary=None):
buf = io.StringIO()
with redirect_stdout(buf), \
patch.object(make_server, "find_audiocpp_server_bin",
- return_value=None):
- make_server._print_launch_hint(audiocpp_dir, output_path,
- pending_build=pending_build)
+ return_value=binary):
+ make_server._print_launch_hint(audiocpp_dir, output_path)
return buf.getvalue()
- def test_pending_build_names_the_post_build_command(self):
+ def test_built_server_prints_nothing(self):
+ # The hub starts/stops the server itself; no manual instructions.
out = self._capture(Path("/tmp/acpp"), Path("/tmp/acpp/server.json"),
- pending_build=True)
- self.assertIn("still building", out)
- self.assertNotIn("Build it first", out)
- self.assertIn("audiocpp_server --config /tmp/acpp/server.json", out)
+ binary=Path("/tmp/acpp/build/x/bin/audiocpp_server"))
+ self.assertEqual(out, "")
def test_missing_binary_gives_build_remediation(self):
out = self._capture(Path("/tmp/acpp"), Path("/tmp/acpp/server.json"))
self.assertIn("Build it first", out)
- self.assertNotIn("still building", out)
+ self.assertNotIn("Start the server with:", out)