Skip to content

Commit

Permalink
deprecate:is_classic_core (#242)
Browse files Browse the repository at this point in the history
OVOS no longer supports running OVOS skills under classic mycroft-core
  • Loading branch information
JarbasAl authored Oct 11, 2024
1 parent f7fd1e4 commit 5d61b6c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 30 deletions.
13 changes: 2 additions & 11 deletions ovos_workshop/skills/ovos.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,9 @@
from ovos_workshop.settings import SkillSettingsManager


@deprecated("OVOS no longer supports running under classic mycroft-core! this function always returns False", "1.0.0")
def is_classic_core():
try:
from mycroft.version import OVOS_VERSION_STR
return False
except:
try:
import mycroft
return True
except:
return False
return False


def simple_trace(stack_trace: List[str]) -> str:
Expand Down Expand Up @@ -851,8 +844,6 @@ def _init_settings(self):
@property
def _monitor_own_settings(self):
# account for isolated setups where skills might not share a filesystem with core
if is_classic_core():
return True
return self.settings.get("monitor_own_settings", False)

def _handle_settings_changed(self, message):
Expand Down
36 changes: 17 additions & 19 deletions test/unittests/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ovos_bus_client import Message

from ovos_workshop.skills.ovos import OVOSSkill
from ovos_workshop.skills.mycroft_skill import MycroftSkill, is_classic_core
from ovos_workshop.skills.mycroft_skill import MycroftSkill
from ovos_workshop.skills import MycroftSkill as CoreSkill
from ovos_utils.messagebus import FakeBus
from os.path import dirname
Expand Down Expand Up @@ -95,16 +95,15 @@ def test_skill_id(self):

self.assertEqual(self.skill.skill_id, "abort.test")

if not is_classic_core():
# the metaclass ensures this returns True under ovos-core
# but we have no control over mycroft-core so can not patch isinstance checks there
self.assertTrue(isinstance(self.skill.instance, CoreSkill))
# the metaclass ensures this returns True under ovos-core
# but we have no control over mycroft-core so can not patch isinstance checks there
self.assertTrue(isinstance(self.skill.instance, CoreSkill))

# if running in ovos-core every message will have the skill_id in context
for msg in self.bus.emitted_msgs:
if msg["type"] == 'mycroft.skills.loaded': # emitted by SkillLoader, not by skill
continue
self.assertEqual(msg["context"]["skill_id"], "abort.test")
# if running in ovos-core every message will have the skill_id in context
for msg in self.bus.emitted_msgs:
if msg["type"] == 'mycroft.skills.loaded': # emitted by SkillLoader, not by skill
continue
self.assertEqual(msg["context"]["skill_id"], "abort.test")

def test_intent_register(self):
padatious_intents = ["abort.test:test.intent",
Expand Down Expand Up @@ -135,15 +134,14 @@ def test_registered_events(self):
self.assertTrue(event in registered_events)

# base skill class events exclusive to ovos-core
if not is_classic_core():
default_ovos = [f"{self.skill.skill_id}.converse.ping",
f"{self.skill.skill_id}.converse.request",
"intent.service.skills.activated",
"intent.service.skills.deactivated",
f"{self.skill.skill_id}.activate",
f"{self.skill.skill_id}.deactivate"]
for event in default_ovos:
self.assertTrue(event in registered_events)
default_ovos = [f"{self.skill.skill_id}.converse.ping",
f"{self.skill.skill_id}.converse.request",
"intent.service.skills.activated",
"intent.service.skills.deactivated",
f"{self.skill.skill_id}.activate",
f"{self.skill.skill_id}.deactivate"]
for event in default_ovos:
self.assertTrue(event in registered_events)

def test_stop(self):
skill = self.skill.instance
Expand Down

0 comments on commit 5d61b6c

Please sign in to comment.