aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_backends_audiocpp.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-25 18:10:08 -0400
committerhistoria <historiavg@proton.me>2026-08-25 18:10:08 -0400
commit4b49797b4d57c2d2cf63472636622a7a6280a38e (patch)
treee3687c734de5d6159cdad288e025057ed6cd3a16 /app/tests/test_backends_audiocpp.py
parentbcac6c42eaf9e004716d72960bddefb1db68a93c (diff)
downloadtts-audiobook-generator-4b49797b4d57c2d2cf63472636622a7a6280a38e.tar.gz
feat: no console drop when uninstalling backends
Diffstat (limited to 'app/tests/test_backends_audiocpp.py')
-rw-r--r--app/tests/test_backends_audiocpp.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/tests/test_backends_audiocpp.py b/app/tests/test_backends_audiocpp.py
index e206ddd..665dbf0 100644
--- a/app/tests/test_backends_audiocpp.py
+++ b/app/tests/test_backends_audiocpp.py
@@ -1836,6 +1836,35 @@ class UninstallTests(unittest.TestCase):
self.assertEqual(rc, 0)
mk_stop.assert_called_once_with("audiocpp")
+ def test_accepts_task_view_kwargs_for_registry_symmetry(self):
+ # The hub calls uninstall(emit=..., cancel=...); emit is unused here
+ # (no subprocess phase) and cancel=None behaves like the plain call.
+ with tempfile.TemporaryDirectory() as td:
+ checkout = Path(td) / "audio.cpp"
+ checkout.mkdir()
+ with patch.object(make_server, "find_local_checkout",
+ return_value=checkout), \
+ patch.object(make_server.servers, "stop"):
+ rc = make_server.uninstall(emit=lambda line: None,
+ cancel=None)
+ self.assertEqual(rc, 0)
+ self.assertFalse(checkout.exists())
+
+ def test_cancel_before_delete_keeps_checkout(self):
+ # Cancel is honored between phases only: once the server is stopped
+ # and cancellation is pending, the checkout deletion never starts.
+ with tempfile.TemporaryDirectory() as td:
+ checkout = Path(td) / "audio.cpp"
+ checkout.mkdir()
+ cancel = threading.Event()
+ cancel.set()
+ with patch.object(make_server, "find_local_checkout",
+ return_value=checkout), \
+ patch.object(make_server.servers, "stop"):
+ rc = make_server.uninstall(cancel=cancel)
+ self.assertEqual(rc, 130)
+ self.assertTrue(checkout.exists())
+
if __name__ == "__main__":
unittest.main()