From 84dca5add8f11ec4479c4f1672a8999dd4b0c409 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Mon, 5 Feb 2024 14:36:36 -0800 Subject: [PATCH] Update tests to latest standards with neon-minerva --- requirements/test.txt | 1 + setup.py | 1 + test/test_skill.py | 44 ++----------------------------------------- 3 files changed, 4 insertions(+), 42 deletions(-) create mode 100644 requirements/test.txt diff --git a/requirements/test.txt b/requirements/test.txt new file mode 100644 index 0000000..55bb597 --- /dev/null +++ b/requirements/test.txt @@ -0,0 +1 @@ +neon-minerva[padatious]~=0.1,>=0.1.1a5 diff --git a/setup.py b/setup.py index ae7b420..9997d94 100644 --- a/setup.py +++ b/setup.py @@ -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, diff --git a/test/test_skill.py b/test/test_skill.py index 20e2085..406b83f 100644 --- a/test/test_skill.py +++ b/test/test_skill.py @@ -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