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

1.0.1 #50

Closed
wants to merge 8 commits into from
Closed
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
21 changes: 8 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
# Changelog

## [0.3.1a4](https://github.com/NeonGeckoCom/skill-demo/tree/0.3.1a4) (2023-06-23)
## [1.0.1a2](https://github.com/NeonGeckoCom/skill-demo/tree/1.0.1a2) (2023-12-15)

[Full Changelog](https://github.com/NeonGeckoCom/skill-demo/compare/0.3.1a3...0.3.1a4)
[Full Changelog](https://github.com/NeonGeckoCom/skill-demo/compare/1.0.1a1...1.0.1a2)

**Merged pull requests:**

- Update init structure for consistency [\#45](https://github.com/NeonGeckoCom/skill-demo/pull/45) ([NeonDaniel](https://github.com/NeonDaniel))
- Update imports and unit tests [\#49](https://github.com/NeonGeckoCom/skill-demo/pull/49) ([NeonDaniel](https://github.com/NeonDaniel))

## [0.3.1a3](https://github.com/NeonGeckoCom/skill-demo/tree/0.3.1a3) (2023-06-15)
## [1.0.1a1](https://github.com/NeonGeckoCom/skill-demo/tree/1.0.1a1) (2023-09-18)

[Full Changelog](https://github.com/NeonGeckoCom/skill-demo/compare/0.3.1a2...0.3.1a3)
[Full Changelog](https://github.com/NeonGeckoCom/skill-demo/compare/1.0.0...1.0.1a1)

**Merged pull requests:**

- Deprecate `create_skill` method and update `__init__` for best practices [\#44](https://github.com/NeonGeckoCom/skill-demo/pull/44) ([NeonDaniel](https://github.com/NeonDaniel))

## [0.3.1a2](https://github.com/NeonGeckoCom/skill-demo/tree/0.3.1a2) (2023-06-14)
**Implemented enhancements:**

[Full Changelog](https://github.com/NeonGeckoCom/skill-demo/compare/0.3.0...0.3.1a2)
- \[FEAT\] Ukrainian Intent Tests [\#38](https://github.com/NeonGeckoCom/skill-demo/issues/38)

**Merged pull requests:**

- Update GH automation to best practices [\#43](https://github.com/NeonGeckoCom/skill-demo/pull/43) ([NeonDaniel](https://github.com/NeonDaniel))
- Refactor mycroft-messagebus-client to ovos-bus-client [\#41](https://github.com/NeonGeckoCom/skill-demo/pull/41) ([NeonDaniel](https://github.com/NeonDaniel))
- Add Ukrainian Intent Tests [\#48](https://github.com/NeonGeckoCom/skill-demo/pull/48) ([NeonDmitry](https://github.com/NeonDmitry))



Expand Down
11 changes: 7 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@
from ovos_config.locations import get_xdg_data_save_path
from ovos_plugin_manager.templates import TTS
from ovos_utils.sound import play_wav

from mycroft.skills import intent_file_handler
from mycroft.skills.skill_data import find_resource
from ovos_workshop.decorators import intent_handler
from ovos_workshop.resource_files import find_resource


class DemoSkill(NeonSkill):
Expand Down Expand Up @@ -100,6 +99,10 @@ def demo_filename(self):
"""
return self.settings.get("filename") or "demo.txt"

@property
def prompt_on_start(self):
return self.settings.get("prompt_on_start", True)

def initialize(self):
# When demo prompt enabled, wait for load and prompt user
if self.settings.get("prompt_on_start"):
Expand Down Expand Up @@ -151,7 +154,7 @@ def _show_demo_prompt(self, message):
self.speak_dialog("confirm_demo_disabled")
self.update_skill_settings({"prompt_on_start": False})

@intent_file_handler("show_demo.intent")
@intent_handler("show_demo.intent")
def handle_show_demo(self, message):
"""
Starts a brief demo
Expand Down
2 changes: 2 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
neon-minerva[padatious]~=0.1
neon-utils>=1.8.1
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def find_resource_files():
url=f'https://github.com/NeonGeckoCom/{SKILL_NAME}',
license='BSD-3-Clause',
install_requires=get_requirements("requirements.txt"),
extras_require={"test": get_requirements("requirements/test.txt")},
author='Neongecko',
author_email='[email protected]',
long_description=long_description,
Expand Down
7 changes: 7 additions & 0 deletions test/test_intents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ en-us:
show_demo.intent:
- i want to see the demo
- show me the demo
uk-ua:
show_demo.intent:
- Хочете, я покажу вам демонстрацію своїх здібностей?
- Мені спитати наступного разу?
- Якщо ви хочете побачити демо в майбутньому, скажіть «Неон, покажи мені демо».
- Це демо. Щоб переглянути його знову, скажіть «покажи мені демо».
- покажи мені демо
49 changes: 9 additions & 40 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,21 @@
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
import shutil
import unittest
from os import mkdir

import pytest

from time import sleep
from copy import deepcopy
from os.path import dirname, join, exists
from mock import Mock
from ovos_bus_client import Message
from ovos_utils.messagebus import FakeBus
import sys


class TestSkill(unittest.TestCase):

@classmethod
def setUpClass(cls) -> None:
from mycroft.skills.skill_loader import SkillLoader

bus = FakeBus()
bus.run_in_thread()
skill_loader = SkillLoader(bus, dirname(dirname(__file__)))
skill_loader.load()
cls.skill = skill_loader.instance
cls.test_fs = join(dirname(__file__), "skill_fs")
if not exists(cls.test_fs):
mkdir(cls.test_fs)
cls.skill.settings_write_path = cls.test_fs
cls.skill.file_system.path = cls.test_fs
cls.skill._init_settings()
cls.skill.initialize()
# Override speak and speak_dialog to test passed arguments
cls.skill.speak = Mock()
cls.skill.speak_dialog = Mock()

@classmethod
def tearDownClass(cls) -> None:
shutil.rmtree(cls.test_fs)
from neon_minerva.tests.skill_unit_test_base import SkillTestCase


class TestSkill(SkillTestCase):
def test_00_skill_init(self):
# Test any parameters expected to be set in init or initialize methods
from neon_utils.skills import NeonSkill

self.assertIsInstance(self.skill, NeonSkill)
self.assertTrue(self.skill.settings["prompt_on_start"])
self.assertTrue(self.skill.prompt_on_start)

def test_skill_show_demo_prompt_no_response(self):
def ask_yesno(dialog):
Expand All @@ -86,8 +53,8 @@ def ask_yesno(dialog):

self.skill._show_demo_prompt(Message("mycroft.ready"))
self.skill.speak_dialog.assert_called_with("confirm_demo_disabled")
self.assertFalse(self.skill.prompt_on_start)
self.assertFalse(self.skill.settings["prompt_on_start"])

self.skill.ask_yesno = default_ask_yesno

def test_skill_show_demo_prompt_no_demo_no_response(self):
Expand All @@ -102,8 +69,8 @@ def ask_yesno(dialog):

self.skill._show_demo_prompt(Message("mycroft.ready"))
self.skill.speak_dialog.assert_called_with("confirm_demo_disabled")
self.assertFalse(self.skill.prompt_on_start)
self.assertFalse(self.skill.settings["prompt_on_start"])

self.skill.ask_yesno = default_ask_yesno

def test_skill_show_demo_prompt_no_demo_no_next_time(self):
Expand All @@ -118,6 +85,7 @@ def ask_yesno(dialog):

self.skill._show_demo_prompt(Message("mycroft.ready"))
self.skill.speak_dialog.assert_called_with("confirm_demo_disabled")
self.assertFalse(self.skill.prompt_on_start)
self.assertFalse(self.skill.settings["prompt_on_start"])

self.skill.ask_yesno = default_ask_yesno
Expand All @@ -134,8 +102,8 @@ def ask_yesno(dialog):

self.skill._show_demo_prompt(Message("mycroft.ready"))
self.skill.speak_dialog.assert_called_with("confirm_demo_enabled")
self.assertTrue(self.skill.prompt_on_start)
self.assertTrue(self.skill.settings["prompt_on_start"])

self.skill.ask_yesno = default_ask_yesno

def test_skill_show_demo_prompt_yes_demo(self):
Expand All @@ -155,6 +123,7 @@ def ask_yesno(dialog):
context={"neon_should_respond": True})
self.skill._show_demo_prompt(message)
self.skill.handle_show_demo.assert_called_with(message)
self.assertFalse(self.skill.prompt_on_start)
self.assertFalse(self.skill.settings["prompt_on_start"])

self.skill.ask_yesno = default_ask_yesno
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = "1.0.0"
__version__ = "1.0.2a1"
Loading