From 02012907e7027100e33ce139db00f12b0af80c18 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 8 May 2024 15:06:48 -0700 Subject: [PATCH] Update for latest ovos-audio compat. (#172) # Description Update for compat with latest ovos-audio alpha release # Issues Needed for https://github.com/NeonGeckoCom/NeonCore/pull/641 # Other Notes --------- Co-authored-by: Daniel McKnight --- neon_audio/tts/neon.py | 3 ++- requirements/requirements.txt | 5 +++-- tests/unit_tests.py | 9 +++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/neon_audio/tts/neon.py b/neon_audio/tts/neon.py index 3589c98..97951da 100644 --- a/neon_audio/tts/neon.py +++ b/neon_audio/tts/neon.py @@ -251,7 +251,8 @@ def _init_playback(self, playback_thread: NeonPlaybackThread = None): init_signal_bus(self.bus) TTS.playback = playback_thread or NeonPlaybackThread(TTS.queue) TTS.playback.set_bus(self.bus) - TTS.playback.attach_tts(self) + if hasattr(TTS.playback, "attach_tts"): + TTS.playback.attach_tts(self) if not TTS.playback.enclosure: TTS.playback.enclosure = EnclosureAPI(self.bus) if not TTS.playback.is_alive(): diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 52a3476..46ae320 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,8 +1,9 @@ -ovos-audio~=0.0.2a38 +ovos-audio~=0.0.2a42 ovos-utils>=0.0.35,<0.2.0 ovos-config~=0.0.10 phoneme-guesser~=0.1 -ovos-plugin-manager~=0.0.24 +# TODO: Alpha patching ovos-audio dependency resolution +ovos-plugin-manager~=0.0.24,>=0.0.26a16 neon-utils[network]~=1.9 click~=8.0 click-default-group~=1.2 diff --git a/tests/unit_tests.py b/tests/unit_tests.py index 01ca5fa..9a168fd 100644 --- a/tests/unit_tests.py +++ b/tests/unit_tests.py @@ -34,6 +34,7 @@ from time import time from os.path import join, dirname from threading import Event +from unittest import skip from unittest.mock import Mock, patch from click.testing import CliRunner from ovos_bus_client import Message @@ -119,6 +120,7 @@ def test_validate_ssml(self): self.assertEqual(valid_tag_string, self.tts.validate_ssml(valid_tag_string)) self.assertEqual(valid_tag_string, self.tts.validate_ssml(extra_tags_string)) + @skip("Method deprecated in ovos-audio") def test_preprocess_sentence(self): # TODO: Legacy sentence = "this is a test" @@ -170,10 +172,9 @@ def test_validator_valid(self): self.assertTrue(self.tts.validator.validate_dependencies()) self.assertTrue(self.tts.validator.validate_connection()) - @patch("ovos_plugin_manager.templates.tts.Configuration") - def test_validator_invalid(self, config): - config.return_value = self.config # Explicitly no g2p - tts = DummyTTS("es", {}) + def test_validator_invalid(self): + tts = DummyTTS("", {}) + tts.validator.validate_lang = Mock(side_effect=Exception("Validation Error")) with self.assertRaises(Exception): tts.validator.validate()