Skip to content

Commit

Permalink
Update tests to extend base class from Minerva
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Feb 6, 2024
1 parent c41e66f commit 01f695b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 45 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.1a5
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='developers@neon.ai',
long_description=long_description,
Expand Down
48 changes: 3 additions & 45 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,55 +25,13 @@
# 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.path
import shutil
import unittest
import pytest
import json

from os import mkdir
from os.path import dirname, join, exists
from mock import Mock
from mycroft_bus_client import Message
from ovos_utils.messagebus import FakeBus

from mycroft.skills.skill_loader import SkillLoader


class TestSkillMethods(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 the fs paths to use the test directory
cls.skill.settings_write_path = cls.test_fs
cls.skill.file_system.path = cls.test_fs

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

def setUp(self):
self.skill.speak.reset_mock()
self.skill.speak_dialog.reset_mock()
import pytest

def tearDown(self) -> None:
self.skill.bus.remove_all_listeners("neon.wake_words_state")
from neon_minerva.tests.skill_unit_test_base import SkillTestCase

@classmethod
def tearDownClass(cls) -> None:
shutil.rmtree(cls.test_fs)

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 import NeonSkill
Expand Down

0 comments on commit 01f695b

Please sign in to comment.