diff options
| author | historia <historiavg@proton.me> | 2026-08-24 13:50:50 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-24 13:50:50 -0400 |
| commit | dff790664389d60d16729092a58d9c0dc490a953 (patch) | |
| tree | 7c29996d78b0c1ae82fa9c4dc71ed39bb70d180e /app/tests/test_converter.py | |
| parent | aac8febbdb45b7994e209bc74a44f8fc98fc745d (diff) | |
| download | tts-audiobook-generator-dff790664389d60d16729092a58d9c0dc490a953.tar.gz | |
remove: --chunk flag (always force client-side chunking)
Diffstat (limited to 'app/tests/test_converter.py')
| -rw-r--r-- | app/tests/test_converter.py | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/app/tests/test_converter.py b/app/tests/test_converter.py index 2fe0f5d..9b0ddb4 100644 --- a/app/tests/test_converter.py +++ b/app/tests/test_converter.py @@ -226,7 +226,6 @@ class DebugDumpTests(unittest.TestCase): self._debug_folder.start() self.debug_root = Path(self._tmp.name) self.converter = AudiobookConverter.__new__(AudiobookConverter) - self.converter.client_chunks = True self.converter.tts = MagicMock() def tearDown(self): @@ -383,7 +382,6 @@ class SynthesizeChunkLoggingTests(unittest.TestCase): def setUp(self): self.converter = AudiobookConverter.__new__(AudiobookConverter) - self.converter.client_chunks = True self.converter.tts = MagicMock() def test_failed_chunk_logs_single_error(self): @@ -403,13 +401,11 @@ class SynthesizeChunkLoggingTests(unittest.TestCase): self.assertIn("Chunk 1/1 error: boom", logs.output[0]) -class ServerSideChunkingOutputTests(unittest.TestCase): - """With client-side chunking off (audiocpp default), the console skips - the chunk vocabulary because the whole request is one server call.""" +class ChunkProgressOutputTests(unittest.TestCase): + """The console reports chunk progress while a conversion runs.""" - def _converter(self, client_chunks: bool): + def _converter(self): converter = AudiobookConverter.__new__(AudiobookConverter) - converter.client_chunks = client_chunks converter.backend = tts.BACKEND_AUDIOCPP converter.speed = 1.0 converter.output_format = "mp3" @@ -417,49 +413,20 @@ class ServerSideChunkingOutputTests(unittest.TestCase): converter.tts.process_chunk_with_retry.return_value = "chunk.wav" return converter - def test_client_chunking_prints_chunk_progress(self): + def test_prints_chunk_progress(self): buf = io.StringIO() with redirect_stdout(buf): - self._converter(client_chunks=True)._synthesize_chunks(["Hello."]) + self._converter()._synthesize_chunks(["Hello."]) out = buf.getvalue() self.assertIn("PROCESSING 1 CHUNKS", out) self.assertIn("Chunk 1/1 completed", out) self.assertIn("Successful: 1/1", out) - def test_server_side_chunking_suppresses_chunk_output(self): - buf = io.StringIO() - with redirect_stdout(buf): - self._converter(client_chunks=False)._synthesize_chunks(["Hello."]) - self.assertEqual(buf.getvalue(), "") - - def test_server_side_chunking_suppresses_chapter_chunk_suffix(self): - buf = io.StringIO() - with patch.object(converter_mod.audio, "combine_chunks", return_value=True), \ - redirect_stdout(buf): - ok = self._converter(client_chunks=False)._convert_text( - "Hello world.", Path("out.mp3"), time.time(), chapter=(2, 5)) - self.assertTrue(ok) - out = buf.getvalue() - self.assertIn("Chapter 2/5 converted", out) - self.assertNotIn("chunk", out.lower()) - - def test_single_request_run_notes_long_wait(self): - buf = io.StringIO() - with patch.object(converter_mod.audio, "combine_chunks", return_value=True), \ - redirect_stdout(buf): - ok = self._converter(client_chunks=False)._convert_text( - "Hello world.", Path("out.mp3"), time.time(), chapter=(2, 5)) - self.assertTrue(ok) - out = buf.getvalue() - self.assertIn("Sending the chapter 2/5 to the audio.cpp server as a " - "single request", out) - self.assertIn("expected for this to take a very long time", out) - - def test_client_chunking_run_keeps_chunk_phrasing(self): + def test_run_keeps_chunk_phrasing(self): buf = io.StringIO() with patch.object(converter_mod.audio, "combine_chunks", return_value=True), \ redirect_stdout(buf): - ok = self._converter(client_chunks=True)._convert_text( + ok = self._converter()._convert_text( "Hello world.", Path("out.mp3"), time.time(), chapter=(2, 5)) self.assertTrue(ok) out = buf.getvalue() @@ -468,7 +435,7 @@ class ServerSideChunkingOutputTests(unittest.TestCase): self.assertIn("Chapter 2/5 converted (1/1 chunks)", out) def test_partial_chunks_abort_without_assembling(self): - converter = self._converter(client_chunks=True) + converter = self._converter() converter.tts.process_chunk_with_retry.side_effect = ["chunk_0001.wav", None] text = " ".join(f"word{i}" for i in range(8)) with patch.object(config, "CHUNK_SIZE", 5), \ |
