From 4fbfa3127436f15318dc60d4ffd32725a3583462 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 8 May 2024 14:24:53 -0700 Subject: [PATCH 1/4] Update for latest ovos-audio compat. --- neon_audio/tts/neon.py | 3 ++- requirements/requirements.txt | 2 +- 2 files changed, 3 insertions(+), 2 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..966fb5f 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ -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 From 11452fd21365024a2bdafcf994d198c7aec42262 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 8 May 2024 14:32:59 -0700 Subject: [PATCH 2/4] Troubleshooting dependency resolution --- requirements/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 966fb5f..46ae320 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,7 +2,8 @@ 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 From 23979447e23154588cc3dab36e7ffd537a296304 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 8 May 2024 14:41:32 -0700 Subject: [PATCH 3/4] Update unit tests for upstream compat. --- tests/unit_tests.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/unit_tests.py b/tests/unit_tests.py index 01ca5fa..296fcb9 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(return_value=False) with self.assertRaises(Exception): tts.validator.validate() From 2c9d081506aa0b8b781592c22c375f3d96e93607 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 8 May 2024 14:50:44 -0700 Subject: [PATCH 4/4] Fix bug in unit test mocking --- tests/unit_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit_tests.py b/tests/unit_tests.py index 296fcb9..9a168fd 100644 --- a/tests/unit_tests.py +++ b/tests/unit_tests.py @@ -174,7 +174,7 @@ def test_validator_valid(self): def test_validator_invalid(self): tts = DummyTTS("", {}) - tts.validator.validate_lang = Mock(return_value=False) + tts.validator.validate_lang = Mock(side_effect=Exception("Validation Error")) with self.assertRaises(Exception): tts.validator.validate()