Skip to content

Commit

Permalink
Update Unit Tests (#68)
Browse files Browse the repository at this point in the history
* Add test extra dependencies
Update unit tests to extend base class

* Update test dependencies

---------

Co-authored-by: Daniel McKnight <[email protected]>
  • Loading branch information
NeonDaniel and NeonDaniel authored Jan 9, 2024
1 parent 5f03fd7 commit 50934d8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
neon-minerva[padatious]~=0.1,>=0.1.1a1
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
33 changes: 3 additions & 30 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,16 @@
# Specialized conversational reconveyance options from Conversation Processing Intelligence Corp.
# US Patents 2008-2021: US7424516, US20140161250, US20140177813, US8638908, US8068604, US8553852, US10530923, US10530924
# China Patent: CN102017585 - Europe Patent: EU2156652 - Patents Pending
import json
import os

import unittest

from copy import deepcopy
from os import mkdir
from os.path import dirname, join, exists
from mock import Mock
from ovos_utils.messagebus import FakeBus
from ovos_bus_client import Message
from mycroft.skills.skill_loader import SkillLoader


class TestSkill(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
bus = FakeBus()
bus.run_in_thread()
skill_loader = SkillLoader(bus, dirname(dirname(__file__)))
skill_loader.load()
cls.skill = skill_loader.instance

# Define a directory to use for testing
cls.test_fs = join(dirname(__file__), "skill_fs")
if not exists(cls.test_fs):
mkdir(cls.test_fs)

# Override fs paths to use the test directory
cls.skill.settings_write_path = cls.test_fs
cls.skill.file_system.path = cls.test_fs
cls.skill._init_settings()
cls.skill.initialize()
from neon_minerva.tests.skill_unit_test_base import SkillTestCase

# Override speak and speak_dialog to test passed arguments
cls.skill.speak = Mock()
cls.skill.speak_dialog = Mock()

class TestSkillMethods(SkillTestCase):
def test_00_skill_init(self):
# Test any parameters expected to be set in init or initialize methods
from neon_utils.skills.common_query_skill import CommonQuerySkill
Expand Down

0 comments on commit 50934d8

Please sign in to comment.