Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubleshooting ovos-classifiers G2P init error #191

Draft
wants to merge 9 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
pytest
pytest-timeout
pytest-cov
ovos-translate-server-plugin
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
40 changes: 37 additions & 3 deletions test/unittests/test_g2p.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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)
1 change: 0 additions & 1 deletion test/unittests/test_stt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Loading