Skip to content

Commit

Permalink
fix skill_directories (#161)
Browse files Browse the repository at this point in the history
* fix skill_directories

closes #159

* tests belong in OPM
  • Loading branch information
JarbasAl authored Dec 29, 2023
1 parent c981e94 commit b2f4268
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 44 deletions.
17 changes: 2 additions & 15 deletions ovos_workshop/skill_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
"""
Expand Down Expand Up @@ -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}")
Expand Down
29 changes: 0 additions & 29 deletions test/unittests/test_skill_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2f4268

Please sign in to comment.