diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 62da0901..81a48f41 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -31,9 +31,8 @@ on: jobs: unit_tests: 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 diff --git a/requirements/test.txt b/requirements/test.txt index 48548151..38446d9f 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,11 @@ pytest pytest-timeout pytest-cov -ovos-translate-server-plugin \ No newline at end of file +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 diff --git a/test/unittests/test_g2p.py b/test/unittests/test_g2p.py index 40b1964a..905ca881 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,39 @@ 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 + + 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) 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()) -