From b2f4268f2c7bb60c8e3c222f96d393f8e1a3c38d Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Fri, 29 Dec 2023 14:02:56 +0000 Subject: [PATCH] fix skill_directories (#161) * fix skill_directories closes https://github.com/OpenVoiceOS/OVOS-workshop/issues/159 * tests belong in OPM --- ovos_workshop/skill_launcher.py | 17 ++-------------- test/unittests/test_skill_launcher.py | 29 --------------------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/ovos_workshop/skill_launcher.py b/ovos_workshop/skill_launcher.py index 23ad3f44..1bcee155 100644 --- a/ovos_workshop/skill_launcher.py +++ b/ovos_workshop/skill_launcher.py @@ -10,7 +10,7 @@ from ovos_bus_client.message import Message from ovos_config.config import Configuration from ovos_config.locale import setup_locale -from ovos_plugin_manager.skills import find_skill_plugins +from ovos_plugin_manager.skills import find_skill_plugins, get_skill_directories from ovos_utils import wait_for_exit_signal from ovos_utils.file_utils import FileWatcher from ovos_utils.log import LOG, deprecated, log_deprecation @@ -34,19 +34,6 @@ SKILL_MAIN_MODULE = '__init__.py' -@deprecated("This method has moved to `ovos_plugin_manager.skills`", "0.1.0") -def get_skill_directories(conf=None): - conf = conf or Configuration() - from ovos_plugin_manager.skills import get_skill_directories as _get_skill_dirs - return _get_skill_dirs(conf) - - -@deprecated("This method has moved to `ovos_plugin_manager.skills`", "0.1.0") -def get_default_skills_directory(conf=None): - from ovos_plugin_manager.skills import get_default_skills_directory - conf = conf or Configuration() - return get_default_skills_directory(conf) - def remove_submodule_refs(module_name: str): """ @@ -563,7 +550,7 @@ def __init__(self, skill_id: str, skill_directory: Optional[str] = None, self.bus = bus self.skill_id = skill_id if not skill_directory: # preference to local skills instead of plugins - for p in _get_skill_dirs(): + for p in get_skill_directories(): if isdir(f"{p}/{skill_id}"): skill_directory = f"{p}/{skill_id}" LOG.debug(f"found local skill {skill_id}: {skill_directory}") diff --git a/test/unittests/test_skill_launcher.py b/test/unittests/test_skill_launcher.py index 0df49bc2..274ff7ef 100644 --- a/test/unittests/test_skill_launcher.py +++ b/test/unittests/test_skill_launcher.py @@ -21,35 +21,6 @@ def tearDownClass(cls) -> None: if isdir(data_path): shutil.rmtree(data_path) - def test_get_skill_directories(self): - from ovos_workshop.skill_launcher import get_skill_directories - # Default directory - mock_config = {'skills': {}} - default_directories = get_skill_directories(mock_config) - for directory in default_directories: - self.assertEqual(basename(directory), 'skills') - # Configured directory - mock_config['skills']['directory'] = 'test' - test_directories = get_skill_directories(mock_config) - for directory in test_directories: - self.assertEqual(basename(directory), 'test') - self.assertEqual(len(default_directories), len(test_directories)) - - def test_get_default_skills_directory(self): - from ovos_workshop.skill_launcher import get_default_skills_directory - # Default directory - mock_config = {'skills': {}} - default_dir = get_default_skills_directory(mock_config) - self.assertTrue(isdir(default_dir)) - self.assertEqual(basename(default_dir), 'skills') - self.assertEqual(dirname(dirname(default_dir)), self.test_data_path) - # Override directory - mock_config['skills']['directory'] = 'test' - test_dir = get_default_skills_directory(mock_config) - self.assertTrue(isdir(test_dir)) - self.assertEqual(basename(test_dir), 'test') - self.assertEqual(dirname(dirname(test_dir)), self.test_data_path) - def test_remove_submodule_refs(self): from ovos_workshop.skill_launcher import remove_submodule_refs pass