tests: yield in wake phrase strategy setup to let tasks start
The strategy schedules background tasks during setup. Fast-running tests could observe state before those tasks had a chance to run; yielding once via asyncio.sleep(0) ensures they do.
This commit is contained in:
@@ -33,6 +33,8 @@ class TestWakePhraseUserTurnStartStrategy(unittest.IsolatedAsyncioTestCase):
|
|||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
task_manager.setup(TaskManagerParams(loop=loop))
|
task_manager.setup(TaskManagerParams(loop=loop))
|
||||||
await strategy.setup(task_manager)
|
await strategy.setup(task_manager)
|
||||||
|
# The tests are quick, so make sure the schedule starts all tasks.
|
||||||
|
await asyncio.sleep(0)
|
||||||
return task_manager
|
return task_manager
|
||||||
|
|
||||||
async def test_wake_phrase_in_final_transcription(self):
|
async def test_wake_phrase_in_final_transcription(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user