forked from forslund/cmd_skill
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
181 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Run Build Tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- dev | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_tests: | ||
strategy: | ||
max-parallel: 2 | ||
matrix: | ||
python-version: [3.8, 3.9, "3.10", "3.11" ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Build Tools | ||
run: | | ||
python -m pip install build wheel | ||
- name: Install System Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt install python3-dev swig libssl-dev | ||
- name: Build Source Packages | ||
run: | | ||
python setup.py sdist | ||
- name: Build Distribution Packages | ||
run: | | ||
python setup.py bdist_wheel | ||
- name: Install skill | ||
run: | | ||
pip install . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Run UnitTests | ||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
paths-ignore: | ||
- 'version.py' | ||
- 'examples/**' | ||
- '.github/**' | ||
- '.gitignore' | ||
- 'LICENSE' | ||
- 'CHANGELOG.md' | ||
- 'MANIFEST.in' | ||
- 'README.md' | ||
- 'scripts/**' | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- 'version.py' | ||
- 'examples/**' | ||
- '.github/**' | ||
- '.gitignore' | ||
- 'LICENSE' | ||
- 'CHANGELOG.md' | ||
- 'MANIFEST.in' | ||
- 'README.md' | ||
- 'scripts/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit_tests: | ||
strategy: | ||
matrix: | ||
python-version: [3.9, "3.10" ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install System Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt install python3-dev | ||
python -m pip install build wheel | ||
- name: Install core repo | ||
run: | | ||
pip install . | ||
- name: Install test dependencies | ||
run: | | ||
pip install pytest pytest-timeout pytest-cov | ||
- name: Install System Dependencies | ||
run: | | ||
sudo apt-get update | ||
- name: Install ovos dependencies | ||
run: | | ||
pip install ovos-plugin-manager | ||
- name: Run unittests | ||
run: | | ||
pytest --cov=ovos-skill-cmd --cov-report xml test | ||
- name: Upload coverage | ||
env: | ||
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} | ||
uses: codecov/codecov-action@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
recursive-include locale * | ||
include *.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import unittest | ||
from ovos_plugin_manager.skills import find_skill_plugins | ||
|
||
|
||
class TestPlugin(unittest.TestCase): | ||
@classmethod | ||
def setUpClass(self): | ||
self.skill_id = "ovos-skill-cmd.openvoiceos" | ||
|
||
def test_find_plugin(self): | ||
plugins = find_skill_plugins() | ||
self.assertIn(self.skill_id, list(plugins)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import unittest | ||
from os.path import dirname | ||
|
||
from ovos_plugin_manager.skills import find_skill_plugins | ||
from ovos_utils.messagebus import FakeBus | ||
from ovos_workshop.skill_launcher import PluginSkillLoader, SkillLoader | ||
from ovos_skill_cmd import CmdSkill | ||
|
||
|
||
class TestSkillLoading(unittest.TestCase): | ||
@classmethod | ||
def setUpClass(self): | ||
self.skill_id = "ovos-skill-cmd.openvoiceos" | ||
self.path = dirname(dirname(__file__)) | ||
|
||
def test_from_class(self): | ||
bus = FakeBus() | ||
skill = CmdSkill() | ||
skill._startup(bus, self.skill_id) | ||
self.assertEqual(skill.bus, bus) | ||
self.assertEqual(skill.skill_id, self.skill_id) | ||
|
||
def test_from_plugin(self): | ||
bus = FakeBus() | ||
for skill_id, plug in find_skill_plugins().items(): | ||
if skill_id == self.skill_id: | ||
skill = plug() | ||
skill._startup(bus, self.skill_id) | ||
self.assertEqual(skill.bus, bus) | ||
self.assertEqual(skill.skill_id, self.skill_id) | ||
break | ||
else: | ||
raise RuntimeError("plugin not found") | ||
|
||
def test_from_loader(self): | ||
bus = FakeBus() | ||
loader = SkillLoader(bus, self.path) | ||
loader.load() | ||
self.assertEqual(loader.instance.bus, bus) | ||
self.assertEqual(loader.instance.root_dir, self.path) | ||
|
||
def test_from_plugin_loader(self): | ||
bus = FakeBus() | ||
loader = PluginSkillLoader(bus, self.skill_id) | ||
for skill_id, plug in find_skill_plugins().items(): | ||
if skill_id == self.skill_id: | ||
loader.load(plug) | ||
break | ||
else: | ||
raise RuntimeError("plugin not found") | ||
|
||
self.assertEqual(loader.skill_id, self.skill_id) | ||
self.assertEqual(loader.instance.bus, bus) | ||
self.assertEqual(loader.instance.skill_id, self.skill_id) |