diff options
| author | historia <historiavg@proton.me> | 2026-08-30 18:49:32 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-30 18:49:32 -0400 |
| commit | 93f106aac2d6411c80a911adac62cd12f80e58be (patch) | |
| tree | 5db8a2ff27f0d06ef313b3cf9ab84bf02f74479f /app/tests/test_runview.py | |
| parent | d31e9149c7f141b2d3c14a79e9f067d524c8c420 (diff) | |
| download | tts-audiobook-generator-93f106aac2d6411c80a911adac62cd12f80e58be.tar.gz | |
feat: output log path when audiobook generation fails
Diffstat (limited to 'app/tests/test_runview.py')
| -rw-r--r-- | app/tests/test_runview.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/app/tests/test_runview.py b/app/tests/test_runview.py index 3f77ed0..5c0dc38 100644 --- a/app/tests/test_runview.py +++ b/app/tests/test_runview.py @@ -333,13 +333,15 @@ class RunLoopTests(_FakeTui, unittest.TestCase): def test_stop_and_exit_stops_server_and_quits_without_keys(self): # Toggle on: the moment the run ends the server is stopped and the - # view reports quit — no key press and no prompt anywhere. + # view reports quit — no key press and no prompt anywhere. A + # successful run's summary does not point at the log file. with patch.object(runview.servers, "alive", return_value=True), \ patch.object(runview.servers, "stop") as mk_stop, \ patch.object(runview.common, "record_post_tui_notice") as mk_notice: view, screen = self.make_view([], autostart_spec="SPEC", - stop_and_exit=True) + stop_and_exit=True, + log_path="/tmp/runs/a.log") view.started_server = True view._queue.put({"kind": "book", "index": 1, "total": 1, "name": "book.txt"}) @@ -355,6 +357,7 @@ class RunLoopTests(_FakeTui, unittest.TestCase): self.assertIn("[OK] book.txt: book_test_michael.mp3", text) self.assertIn("1 of 1 book(s) generated successfully", text) self.assertIn("Elapsed time:", text) + self.assertNotIn("Full details in the log file", text) def test_stop_and_exit_leaves_external_servers_alone(self): # A server this run did not start is never stopped; the TUI still @@ -374,13 +377,15 @@ class RunLoopTests(_FakeTui, unittest.TestCase): def test_stop_and_exit_failure_summary_lists_the_error(self): # A failed ending also auto-exits; the failing book's detail line - # lands in the post-TUI summary. + # lands in the post-TUI summary, which ends with the converter's + # log file path where the full details live. with patch.object(runview.servers, "alive", return_value=True), \ patch.object(runview.servers, "stop"), \ patch.object(runview.common, "record_post_tui_notice") as mk_notice: view, screen = self.make_view([], autostart_spec="SPEC", - stop_and_exit=True) + stop_and_exit=True, + log_path="/tmp/runs/a.log") view.started_server = True view._queue.put({"kind": "book_failed", "name": "bad.txt", "error": "chunk 3 failed", @@ -392,6 +397,22 @@ class RunLoopTests(_FakeTui, unittest.TestCase): self.assertIn("[FAIL] bad.txt: bad_x.mp3", text) self.assertIn("chunk 3 failed", text) self.assertIn("0 of 1 book(s) generated successfully", text) + self.assertIn("Full details in the log file: /tmp/runs/a.log", text) + + def test_stop_and_exit_empty_failure_summary_lists_the_log(self): + # A run that errors before any book result (worker crash) still + # points the post-TUI summary at the log file. + with patch.object(runview.servers, "stop"), \ + patch.object(runview.common, + "record_post_tui_notice") as mk_notice: + view, screen = self.make_view([], stop_and_exit=True, + log_path="/tmp/runs/a.log") + view._queue.put({"kind": "error", "message": "boom"}) + view.run() + self.assertIn("No books were converted", + mk_notice.call_args[0][0]) + self.assertIn("Full details in the log file: /tmp/runs/a.log", + mk_notice.call_args[0][0]) class WorkerTests(_FakeTui, unittest.TestCase): |
