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

Fix bug causing dialog tests to pass when translations are missing #11

Merged
merged 1 commit into from
Dec 7, 2023
Merged
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
7 changes: 5 additions & 2 deletions neon_minerva/skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ def get_skill_object(skill_entrypoint: str, bus: FakeBus,
@param skill_entrypoint: Skill plugin entrypoint or directory path
@param bus: FakeBus instance to bind to skill for testing
@param skill_id: skill_id to initialize skill with
@param config_patch: Configuration update to apply
@returns: Initialized skill object
"""
if config_patch:
from ovos_config.config import update_mycroft_config
update_mycroft_config(config_patch)
from ovos_config.config import update_mycroft_config, Configuration
user_config = update_mycroft_config(config_patch)
if user_config not in Configuration.xdg_configs:
Configuration.xdg_configs.append(user_config)
if isdir(skill_entrypoint):
LOG.info(f"Loading local skill: {skill_entrypoint}")
from ovos_workshop.skill_launcher import SkillLoader
Expand Down
13 changes: 7 additions & 6 deletions neon_minerva/tests/test_skill_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import unittest
import os
import json

from os import getenv
Expand Down Expand Up @@ -84,7 +83,8 @@ def test_skill_setup(self):
self.assertEqual(self.skill.skill_id, self.test_skill_id)
self.assertEqual(set([self.skill._core_lang] +
self.skill._secondary_langs),
set(self.supported_languages))
set(self.supported_languages),
f"expected={self.supported_languages}")

def test_intent_registration(self):
registered_adapt = list()
Expand Down Expand Up @@ -137,8 +137,9 @@ def test_intent_registration(self):

def test_dialog_files(self):
for lang in self.supported_languages:
dialogs = self.skill._lang_resources[lang].dialog_renderer.templates
for dialog in self.dialog:
file = self.skill.find_resource(f"{dialog}.dialog", "dialog",
lang)
self.assertIsInstance(file, str, f"{dialog} in {self.dialog}")
self.assertTrue(os.path.isfile(file), dialog)
self.assertIn(dialog, dialogs.keys(),
f"lang={lang}")

# TODO: Consider adding tests for resource file existence
Loading