Hopefully fixed weird gstreamer traceback.

This commit is contained in:
Storm Dragon
2026-04-04 23:04:33 -04:00
parent 20e61d6259
commit 64ad1ab3e0
10 changed files with 75 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
import sys
import types
import unittest
import importlib
from pathlib import Path
from unittest import mock
@@ -31,6 +32,7 @@ soundGeneratorStub.Tone = _Tone
sys.modules.setdefault("cthulhu.sound_generator", soundGeneratorStub)
from cthulhu import settings
from cthulhu import piper_audio_player
from cthulhu import sound
from cthulhu import sound_sink
@@ -46,6 +48,23 @@ class SoundSinkTests(unittest.TestCase):
self.assertGreaterEqual(len(candidates), 1)
self.assertEqual(candidates[0], "autoaudiosink")
def test_gstreamer_init_check_bool_result_does_not_break_imports(self):
modules = [
sound_sink,
sound,
piper_audio_player,
]
with mock.patch.object(sound_sink.Gst, "init_check", return_value=True):
reloadedModules = []
for module in modules:
reloaded = importlib.reload(module)
reloadedModules.append(reloaded)
self.assertTrue(reloaded._gstreamerAvailable)
for module in reloadedModules:
importlib.reload(module)
class PlayerRecoveryTests(unittest.TestCase):
def test_worker_diagnostic_marks_restart_required(self):