From 1fb0bb0ead895a98cebf2d5709338d6fb316faf2 Mon Sep 17 00:00:00 2001 From: Raivis Dejus Date: Sat, 28 Feb 2026 11:28:11 +0200 Subject: [PATCH] Fix for a test --- tests/mock_sounddevice.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/mock_sounddevice.py b/tests/mock_sounddevice.py index 820199f9..fecdda15 100644 --- a/tests/mock_sounddevice.py +++ b/tests/mock_sounddevice.py @@ -135,7 +135,12 @@ class MockInputStream: if self._stop_event.is_set(): break chunk = audio[seek : seek + num_samples_in_chunk] - self.callback(chunk, 0, None, None) + try: + self.callback(chunk, 0, None, None) + except RuntimeError: + # Qt object was deleted between the stop-event check and + # the callback invocation; treat it as a stop signal. + break seek += num_samples_in_chunk # loop back around