From 9335ba8543c08b44ac59fff44b7229efd30cc3c5 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 15:08:17 -0700 Subject: [PATCH 1/9] Add minimal G2PFactory tests Add ovos-classifiers to test dependencies to troubleshoot #189 --- requirements/test.txt | 3 ++- test/unittests/test_g2p.py | 32 +++++++++++++++++++++++++++++--- test/unittests/test_stt.py | 1 - 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/requirements/test.txt b/requirements/test.txt index 48548151..a7b6cedc 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,5 @@ pytest pytest-timeout pytest-cov -ovos-translate-server-plugin \ No newline at end of file +ovos-translate-server-plugin +ovos-classifiers \ No newline at end of file diff --git a/test/unittests/test_g2p.py b/test/unittests/test_g2p.py index 40b1964a..6f18b52b 100644 --- a/test/unittests/test_g2p.py +++ b/test/unittests/test_g2p.py @@ -1,6 +1,6 @@ import unittest -from unittest.mock import patch +from unittest.mock import patch, Mock from enum import Enum from ovos_plugin_manager.utils import PluginTypes, PluginConfigTypes @@ -72,5 +72,31 @@ def test_get_config(self, get_config): class TestG2PFactory(unittest.TestCase): - from ovos_plugin_manager.g2p import OVOSG2PFactory - # TODO + def test_mappings(self): + from ovos_plugin_manager.g2p import OVOSG2PFactory + self.assertIsInstance(OVOSG2PFactory.MAPPINGS, dict) + for key in OVOSG2PFactory.MAPPINGS: + self.assertIsInstance(key, str) + self.assertIsInstance(OVOSG2PFactory.MAPPINGS[key], str) + self.assertNotEqual(key, OVOSG2PFactory.MAPPINGS[key]) + + @patch("ovos_plugin_manager.g2p.load_g2p_plugin") + def test_get_class(self, load_plugin): + from ovos_plugin_manager.g2p import OVOSG2PFactory + from ovos_plugin_manager.templates.g2p import Grapheme2PhonemePlugin + global_config = {"g2p": {"module": "dummy"}} + g2p_config = {"module": "test-g2p-plugin-test"} + + # Test load plugin mapped global config + plugin = OVOSG2PFactory.get_class(global_config) + self.assertEqual(plugin, Grapheme2PhonemePlugin) + + # Test load plugin explicit TTS config + OVOSG2PFactory.get_class(g2p_config) + load_plugin.assert_called_with("test-g2p-plugin-test") + + @patch("ovos_plugin_manager.g2p.OVOSG2PFactory.get_class") + def test_create(self, get_class): + from ovos_plugin_manager.g2p import OVOSG2PFactory + get_class = Mock() + # TODO diff --git a/test/unittests/test_stt.py b/test/unittests/test_stt.py index a1705dd3..45949096 100644 --- a/test/unittests/test_stt.py +++ b/test/unittests/test_stt.py @@ -153,4 +153,3 @@ def test_create(self, get_class): get_class.assert_called_with(expected_config) plugin_class.assert_called_with(expected_config) self.assertEqual(plugin, plugin_class()) - From 3fbe403f92d9407ab07ac353a315d51784515372 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 15:09:30 -0700 Subject: [PATCH 2/9] Add Python3.11 unit tests for #189 --- .github/workflows/unit_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 62da0901..56e5326f 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -33,7 +33,7 @@ jobs: strategy: max-parallel: 2 matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] + python-version: [ 3.7, 3.8, 3.9, "3.10", 3.11 ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 28334026545b1fff8a865f13034e4dd2fb74c915 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 15:15:43 -0700 Subject: [PATCH 3/9] Add specific test case to troubleshoot #189 --- test/unittests/test_g2p.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/unittests/test_g2p.py b/test/unittests/test_g2p.py index 6f18b52b..905ca881 100644 --- a/test/unittests/test_g2p.py +++ b/test/unittests/test_g2p.py @@ -100,3 +100,11 @@ def test_create(self, get_class): from ovos_plugin_manager.g2p import OVOSG2PFactory get_class = Mock() # TODO + + def test_create_arpa(self): + # Testing a specific failure reported in #189 + from ovos_plugin_manager.g2p import OVOSG2PFactory + from ovos_plugin_manager.templates.g2p import Grapheme2PhonemePlugin + config = {"module": "ovos-g2p-plugin-heuristic-arpa"} + plugin = OVOSG2PFactory.create(config) + self.assertIsInstance(plugin, Grapheme2PhonemePlugin) From b71c5c6fd05d7c5989180d3992fc5ea15b2df09b Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 15:48:34 -0700 Subject: [PATCH 4/9] Add more test dependencies to try and reproduce #189 --- requirements/test.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/requirements/test.txt b/requirements/test.txt index a7b6cedc..be79e754 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,4 +2,9 @@ pytest pytest-timeout pytest-cov ovos-translate-server-plugin -ovos-classifiers \ No newline at end of file + +# Below for #189 +ovos-classifiers>=0.0.0a37 +ovos-tts-server>=0.0.3a9 +ovos-tts-plugin-mimic3[all]>=0.0.1a2 +onnxruntime>=1.16.1 \ No newline at end of file From 43a81d0f3043c4b74192541726151ebff7aee5ef Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 15:55:02 -0700 Subject: [PATCH 5/9] Troubleshoot package causing exception --- requirements/test.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/test.txt b/requirements/test.txt index be79e754..fcffb3e8 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -5,6 +5,6 @@ ovos-translate-server-plugin # Below for #189 ovos-classifiers>=0.0.0a37 -ovos-tts-server>=0.0.3a9 +# ovos-tts-server>=0.0.3a9 ovos-tts-plugin-mimic3[all]>=0.0.1a2 -onnxruntime>=1.16.1 \ No newline at end of file +# onnxruntime \ No newline at end of file From 00364f735b6edbb62a214554f5e985a2de240080 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 16:06:09 -0700 Subject: [PATCH 6/9] Update automation to allow all unit tests to run in parallel Troubleshoot conflicting dependency --- .github/workflows/unit_tests.yml | 1 - requirements/test.txt | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 56e5326f..81a48f41 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -31,7 +31,6 @@ on: jobs: unit_tests: strategy: - max-parallel: 2 matrix: python-version: [ 3.7, 3.8, 3.9, "3.10", 3.11 ] runs-on: ubuntu-latest diff --git a/requirements/test.txt b/requirements/test.txt index fcffb3e8..feb9d1c2 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -6,5 +6,6 @@ ovos-translate-server-plugin # Below for #189 ovos-classifiers>=0.0.0a37 # ovos-tts-server>=0.0.3a9 -ovos-tts-plugin-mimic3[all]>=0.0.1a2 +mycroft-mimic3-tts<1.0 +# ovos-tts-plugin-mimic3[all]>=0.0.1a2 # onnxruntime \ No newline at end of file From 630c527c77ae6011f231042cf0ab121d04996b9f Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 16:09:51 -0700 Subject: [PATCH 7/9] More testing. If this fails, the issue is in one or more of the language modules --- requirements/test.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/requirements/test.txt b/requirements/test.txt index feb9d1c2..1988cdf6 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -5,7 +5,5 @@ ovos-translate-server-plugin # Below for #189 ovos-classifiers>=0.0.0a37 -# ovos-tts-server>=0.0.3a9 mycroft-mimic3-tts<1.0 -# ovos-tts-plugin-mimic3[all]>=0.0.1a2 -# onnxruntime \ No newline at end of file +ovos-tts-plugin-mimic3>=0.0.1a2 \ No newline at end of file From 1360dd0412ed15b72ae7380ad95004c1ba8606ed Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 16:13:49 -0700 Subject: [PATCH 8/9] Test if mimic3 extras cause same issue with Python3.11 (likely `gruut` if this fails) --- requirements/test.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/test.txt b/requirements/test.txt index 1988cdf6..638a89d3 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -5,5 +5,5 @@ ovos-translate-server-plugin # Below for #189 ovos-classifiers>=0.0.0a37 -mycroft-mimic3-tts<1.0 -ovos-tts-plugin-mimic3>=0.0.1a2 \ No newline at end of file +mycroft-mimic3-tts[all]<1.0 +# ovos-tts-plugin-mimic3>=0.0.1a2 \ No newline at end of file From 4b7e85ace4ff54f9d14bd474b56b151ac3725769 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 25 Oct 2023 16:19:33 -0700 Subject: [PATCH 9/9] Try to isolate package causing failure --- requirements/test.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements/test.txt b/requirements/test.txt index 638a89d3..38446d9f 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -6,4 +6,6 @@ ovos-translate-server-plugin # Below for #189 ovos-classifiers>=0.0.0a37 mycroft-mimic3-tts[all]<1.0 +nltk~=3.8 +# Failing case installs nltk 3.3, passing installed 3.8.1 # ovos-tts-plugin-mimic3>=0.0.1a2 \ No newline at end of file