From bb83616f53d8d7856ed0bf6b06297fa95b86dfec Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Thu, 9 May 2024 12:20:18 -0700 Subject: [PATCH] Add test case to validate backend plugin load (#62) * Add test case to validate backend plugin load * Update dependency to test https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/224 * Update OPM dependency to pip spec --------- Co-authored-by: Daniel McKnight --- requirements/requirements.txt | 2 +- test/requirements.txt | 4 +++- test/unittests/test_service.py | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 56c8963..094ef9f 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ ovos-utils~=0.0, >=0.0.38 ovos-bus-client~=0.0, >=0.0.8 ovos-config~=0.0,>=0.0.13a7 -ovos-plugin-manager~=0.0, >=0.0.26a16 +ovos-plugin-manager~=0.0, >=0.0.26a16 \ No newline at end of file diff --git a/test/requirements.txt b/test/requirements.txt index ce20b09..e6a8bed 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -4,4 +4,6 @@ pytest==5.2.4 pytest-cov==2.8.1 cov-core==1.15.0 sphinx==2.2.1 -sphinx-rtd-theme==0.4.3 \ No newline at end of file +sphinx-rtd-theme==0.4.3 +ovos-audio-plugin-simple~=0.0.1 +ovos-plugin-vlc~=0.0.1 \ No newline at end of file diff --git a/test/unittests/test_service.py b/test/unittests/test_service.py index 6bd86e0..bff46f8 100644 --- a/test/unittests/test_service.py +++ b/test/unittests/test_service.py @@ -222,6 +222,22 @@ def test_audio_service_queue_methods(self, mock_load_services): service.shutdown() + @mock.patch("ovos_audio.audio.Configuration") + def test_load_backends(self, mock_config): + mock_config.return_value = {} + service = AudioService(self.emitter) + service_names = set([s.name for s in service.service]) + self.assertEqual(service_names, + {"ovos_common_play", "ovos_vlc", "ovos_simple"}, + service_names) + service.shutdown() + + service = AudioService(self.emitter, disable_ocp=True) + service_names = [s.name for s in service.service] + self.assertEqual(service_names, {"ovos_vlc", "ovos_simple"}, + service_names) + service.shutdown() + if __name__ == "__main__": unittest.main()