Skip to content

Commit

Permalink
Update tests to latest standards with neon-minerva
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Feb 5, 2024
1 parent df11fbf commit 84dca5a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 42 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='[email protected]',
long_description=long_description,
Expand Down
44 changes: 2 additions & 42 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,53 +26,13 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import shutil
import unittest
import pytest

from os import mkdir
from os.path import dirname, join, exists
from mock import Mock
from ovos_bus_client import Message
from ovos_plugin_common_play import MediaType
from ovos_utils.messagebus import FakeBus
from neon_minerva.tests.skill_unit_test_base import SkillTestCase

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 the configuration and 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()

# 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()

@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 ovos_workshop.skills.common_play import OVOSCommonPlaybackSkill
Expand Down

0 comments on commit 84dca5a

Please sign in to comment.