Skip to content

Commit

Permalink
fix:cache_gui_files
Browse files Browse the repository at this point in the history
companion to OpenVoiceOS/ovos-gui#53 and OpenVoiceOS/ovos-bus-client#120

this should be merged first as it does not require the others to work and does not break anything in the wild
  • Loading branch information
JarbasAl committed Sep 18, 2024
1 parent bf1acd6 commit d988c36
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ovos-utils>=0.0.38,<1.0.0
ovos_bus_client>=0.0.8,<1.0.0
ovos_bus_client>=0.0.8,<2.0.0
ovos-config>=0.0.12,<1.0.0
ovos-backend-client>=0.1.0,<2.0.0
ovos-lingua-franca>=0.4.6,<1.0.0
Expand Down
41 changes: 0 additions & 41 deletions test/unittests/skills/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,44 +541,3 @@ def test_get_scheduled_event_status(self):
def test_cancel_all_repeating_events(self):
# TODO
pass


class TestSkillGui(unittest.TestCase):
class LegacySkill(Mock):
skill_id = "old_skill"
bus = FakeBus()
config_core = {"gui": {"test": True,
"legacy": True}}
root_dir = join(dirname(__file__), "test_gui/gui")

class GuiSkill(Mock):
skill_id = "new_skill"
bus = FakeBus()
config_core = {"gui": {"test": True,
"legacy": False}}
root_dir = join(dirname(__file__), "test_gui")

@patch("ovos_workshop.skills.ovos.GUIInterface.__init__")
def test_skill_gui(self, interface_init):
from ovos_bus_client.apis.gui import GUIInterface
from ovos_workshop.skills.base import SkillGUI

# Old skill with `ui` directory in root
old_skill = self.LegacySkill()
old_gui = SkillGUI(old_skill)
self.assertEqual(old_gui.skill, old_skill)
self.assertIsInstance(old_gui, GUIInterface)
interface_init.assert_called_once_with(
old_gui, skill_id=old_skill.skill_id, bus=old_skill.bus,
config=old_skill.config_core['gui'],
ui_directories={"qt5": join(old_skill.root_dir, "ui")})

# New skill with `gui` directory in root
new_skill = self.GuiSkill()
new_gui = SkillGUI(new_skill)
self.assertEqual(new_gui.skill, new_skill)
self.assertIsInstance(new_gui, GUIInterface)
interface_init.assert_called_with(
new_gui, skill_id=new_skill.skill_id, bus=new_skill.bus,
config=new_skill.config_core['gui'],
ui_directories={"all": join(new_skill.root_dir, "gui")})

0 comments on commit d988c36

Please sign in to comment.