fix(settings): stop Test Dictation calling a missing model "no speech" (#702)
* fix(settings): stop Test Dictation calling a missing model "no speech" start_recognition now returns whether listening actually began. Test Dictation checks that before starting its timer, so a missing or auto-paused model gets a real error instead of "No speech detected". * fix(settings): reconfigure Test Dictation against the live engine UI matching config.json is not enough when speech_engine is still on another engine or model size. Compare those too before the listen timer. * fix(tests): keep settings_dialog lookups on one module _load_settings_dialog() restored sys.modules but left vocalinux.ui.settings_dialog pointing at the private reload. Python 3.9/3.10 mock follows that attribute, so test_whisper_list_and_delete patched a different copy than it imported and the expanduser stub hid the real cache. Point the package attribute back at the restored module, and patch the imported module object in the deletion test.
This commit is contained in:
@@ -474,7 +474,7 @@ class TestStartStopRecognition(unittest.TestCase):
|
||||
"""Test successful recognition start."""
|
||||
manager = SpeechRecognitionManager(engine="vosk")
|
||||
|
||||
manager.start_recognition()
|
||||
self.assertTrue(manager.start_recognition())
|
||||
|
||||
self.assertEqual(manager.state, RecognitionState.LISTENING)
|
||||
self.assertTrue(manager.should_record)
|
||||
@@ -492,7 +492,7 @@ class TestStartStopRecognition(unittest.TestCase):
|
||||
# Second start should not create new threads
|
||||
manager.audio_thread = self.threadInstance
|
||||
manager.recognition_thread = self.threadInstance
|
||||
manager.start_recognition()
|
||||
self.assertFalse(manager.start_recognition())
|
||||
|
||||
# No new threads created
|
||||
self.threadMock.assert_not_called()
|
||||
|
||||
Reference in New Issue
Block a user