Hopefully fixed weird gstreamer traceback.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user