diff options
| author | historia <historiavg@proton.me> | 2026-09-01 14:32:05 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-09-01 14:32:05 -0400 |
| commit | 6cfcd564c0684c52618235e6366f4a81c02b9a5b (patch) | |
| tree | 55321760a8103bc6b5d79489fac4135a60e6e3ba /app/tests/test_converter_progress.py | |
| parent | dc6e7cd43029da62dabe2513fb5aa8a34df1bd6d (diff) | |
| download | tts-audiobook-generator-6cfcd564c0684c52618235e6366f4a81c02b9a5b.tar.gz | |
slop refactor/dedup
Diffstat (limited to 'app/tests/test_converter_progress.py')
| -rw-r--r-- | app/tests/test_converter_progress.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/tests/test_converter_progress.py b/app/tests/test_converter_progress.py index d77e9e0..0a44725 100644 --- a/app/tests/test_converter_progress.py +++ b/app/tests/test_converter_progress.py @@ -225,6 +225,24 @@ class CancelTests(unittest.TestCase): converter = self.fixture.build(cancel=threading.Event()) converter._check_cancelled() # no raise + def test_cancel_event_reaches_the_client_before_connect(self): + # The cancel event must be wired into the TTS client at + # construction time — connect-time work (health check, model + # listing, voice validation) is otherwise un-cancellable. + cancel = threading.Event() + cancel.set() + client = MagicMock() + client.cancel = None + with patch.object(converter_mod, "QwenTTSClient", + return_value=client) as mock_qwen: + AudiobookConverter(voice_mode=VOICE_MODE_CUSTOM, + backend=BACKEND_QWEN, voice="Vivian", + cancel=cancel) + self.assertIs(mock_qwen.call_args.kwargs["cancel"], cancel) + with self.assertRaises(ConversionCancelled): + converter_mod.AudiobookConverter._check_cancelled( + MagicMock(tts=None, _cancel=cancel)) + if __name__ == "__main__": unittest.main() |
