From f9d8c8d36014ab09e56da8e6cd38354cb24c1a11 Mon Sep 17 00:00:00 2001 From: miro Date: Tue, 15 Oct 2024 18:48:14 +0100 Subject: [PATCH] move tests to corresponding repos --- .../configuration/__init__.py | 14 -- .../configuration/mycroft.conf | 9 - .../configuration/mycroft.json | 234 ------------------ .../configuration/mycroft.yml | 193 --------------- .../configuration/test_configuration.py | 90 ------- test/integrationtests/dialog/__init__.py | 0 .../dialog/multiple_dialogs/one.dialog | 1 - .../dialog/multiple_dialogs/two.dialog | 1 - .../example-context.context.json | 5 - .../mustache_templates/example-context.dialog | 1 - .../mustache_templates/example-context.result | 1 - .../example-simple.context.json | 1 - .../mustache_templates/example-simple.dialog | 1 - .../mustache_templates/example-simple.result | 1 - .../example-comments.dialog | 2 - .../example-comments.result | 1 - .../example-multiple-context.context.json | 3 - .../example-multiple-context.dialog | 3 - .../example-multiple-context.result | 3 - .../example-multiple.context.json | 1 - .../example-multiple.dialog | 3 - .../example-multiple.result | 3 - test/integrationtests/dialog/test_dialog.py | 104 -------- .../intent_file/vocab/en-us/test.intent | 0 .../intent_file/vocab/en-us/test_ent.entity | 0 .../locale/en-us/turn_off2_test.voc | 1 - .../locale/en-us/turn_off_test.voc | 3 - test/integrationtests/test_audioservice.py | 177 ------------- .../test_common_play_skill.py | 143 ----------- test/integrationtests/test_event_container.py | 68 ----- test/integrationtests/test_event_scheduler.py | 124 ---------- test/integrationtests/test_lock.py | 70 ------ test/integrationtests/test_selene_api.py | 2 + .../in-dialog/dialog/en-us/good_things.list | 3 - .../in-dialog/dialog/en-us/named_things.value | 4 - .../in-dialog/dialog/en-us/test.template | 1 - .../in-locale/locale/de-de/good_things.list | 3 - .../in-locale/locale/de-de/named_things.value | 3 - .../in-locale/locale/de-de/test.template | 1 - .../in-locale/locale/en-us/good_things.list | 3 - .../in-locale/locale/en-us/named_things.value | 4 - .../in-locale/locale/en-us/not_in_german.list | 3 - .../in-locale/locale/en-us/test.template | 1 - test/unittests/test_skill/__init__.py | 4 +- 44 files changed, 4 insertions(+), 1289 deletions(-) delete mode 100644 test/integrationtests/configuration/__init__.py delete mode 100644 test/integrationtests/configuration/mycroft.conf delete mode 100644 test/integrationtests/configuration/mycroft.json delete mode 100644 test/integrationtests/configuration/mycroft.yml delete mode 100644 test/integrationtests/configuration/test_configuration.py delete mode 100644 test/integrationtests/dialog/__init__.py delete mode 100644 test/integrationtests/dialog/multiple_dialogs/one.dialog delete mode 100644 test/integrationtests/dialog/multiple_dialogs/two.dialog delete mode 100644 test/integrationtests/dialog/mustache_templates/example-context.context.json delete mode 100644 test/integrationtests/dialog/mustache_templates/example-context.dialog delete mode 100644 test/integrationtests/dialog/mustache_templates/example-context.result delete mode 100644 test/integrationtests/dialog/mustache_templates/example-simple.context.json delete mode 100644 test/integrationtests/dialog/mustache_templates/example-simple.dialog delete mode 100644 test/integrationtests/dialog/mustache_templates/example-simple.result delete mode 100644 test/integrationtests/dialog/mustache_templates_comments/example-comments.dialog delete mode 100644 test/integrationtests/dialog/mustache_templates_comments/example-comments.result delete mode 100644 test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.context.json delete mode 100644 test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.dialog delete mode 100644 test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.result delete mode 100644 test/integrationtests/dialog/mustache_templates_multiple/example-multiple.context.json delete mode 100644 test/integrationtests/dialog/mustache_templates_multiple/example-multiple.dialog delete mode 100644 test/integrationtests/dialog/mustache_templates_multiple/example-multiple.result delete mode 100644 test/integrationtests/dialog/test_dialog.py delete mode 100644 test/integrationtests/intent_file/vocab/en-us/test.intent delete mode 100644 test/integrationtests/intent_file/vocab/en-us/test_ent.entity delete mode 100644 test/integrationtests/locale/en-us/turn_off2_test.voc delete mode 100644 test/integrationtests/locale/en-us/turn_off_test.voc delete mode 100644 test/integrationtests/test_audioservice.py delete mode 100644 test/integrationtests/test_common_play_skill.py delete mode 100644 test/integrationtests/test_event_container.py delete mode 100644 test/integrationtests/test_event_scheduler.py delete mode 100644 test/integrationtests/test_lock.py delete mode 100644 test/integrationtests/translate/in-dialog/dialog/en-us/good_things.list delete mode 100644 test/integrationtests/translate/in-dialog/dialog/en-us/named_things.value delete mode 100644 test/integrationtests/translate/in-dialog/dialog/en-us/test.template delete mode 100644 test/integrationtests/translate/in-locale/locale/de-de/good_things.list delete mode 100644 test/integrationtests/translate/in-locale/locale/de-de/named_things.value delete mode 100644 test/integrationtests/translate/in-locale/locale/de-de/test.template delete mode 100644 test/integrationtests/translate/in-locale/locale/en-us/good_things.list delete mode 100644 test/integrationtests/translate/in-locale/locale/en-us/named_things.value delete mode 100644 test/integrationtests/translate/in-locale/locale/en-us/not_in_german.list delete mode 100644 test/integrationtests/translate/in-locale/locale/en-us/test.template diff --git a/test/integrationtests/configuration/__init__.py b/test/integrationtests/configuration/__init__.py deleted file mode 100644 index b5d9e70242d7..000000000000 --- a/test/integrationtests/configuration/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2017 Mycroft AI Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/test/integrationtests/configuration/mycroft.conf b/test/integrationtests/configuration/mycroft.conf deleted file mode 100644 index cbb649ab6980..000000000000 --- a/test/integrationtests/configuration/mycroft.conf +++ /dev/null @@ -1,9 +0,0 @@ -{ - "lang": "pt-br", - "tts": { - "module": "espeak", - "espeak": { - "voice": "f1" - } - } -} diff --git a/test/integrationtests/configuration/mycroft.json b/test/integrationtests/configuration/mycroft.json deleted file mode 100644 index f54fee213d6a..000000000000 --- a/test/integrationtests/configuration/mycroft.json +++ /dev/null @@ -1,234 +0,0 @@ -{ - "Audio": { - "backends": { - "OCP": { - "active": true, - "type": "ovos_common_play" - }, - "simple": { - "active": true, - "type": "ovos_audio_simple" - }, - "vlc": { - "active": true, - "type": "ovos_vlc" - } - }, - "default-backend": "OCP" - }, - "cache_path": "/tmp/mycroft/cache", - "confirm_listening": true, - "date_format": "MDY", - "debug": false, - "enclosure": { - "force_mycroft_ntp": true, - "ntp_sync_on_boot": false, - "platform": "PHAL" - }, - "gui": { - "extension": "generic", - "generic": { - "homescreen_supported": false - } - }, - "gui_websocket": { - "base_port": 18181, - "host": "0.0.0.0", - "route": "/gui", - "ssl": false - }, - "hotwords": { - "hey mycroft": { - "lang": "en-us", - "listen": true, - "model": "https://github.com/MycroftAI/precise-data/raw/models-dev/hey-mycroft.tar.gz", - "module": "ovos-ww-plugin-precise", - "phonemes": "HH EY . M AY K R AO F T", - "sound": "snd/start_listening.wav", - "threshold": 1e-90, - "version": "0.3" - }, - "wake up": { - "lang": "en-us", - "module": "ovos-ww-plugin-pocketsphinx", - "phonemes": "W EY K . AH P", - "threshold": 1e-20, - "wakeup": true - } - }, - "ignore_logs": [ - "enclosure.mouth.viseme", - "enclosure.mouth.display" - ], - "lang": "en-us", - "listener": { - "VAD": { - "before_seconds": 0.5, - "initial_energy_threshold": 1000.0, - "max_current_ratio_threshold": 2, - "min_seconds": 1, - "module": "", - "ovos-vad-plugin-silero": { - "threshold": 0.2 - }, - "ovos-vad-plugin-webrtcvad": { - "vad_mode": 3 - }, - "silence_method": "vad_and_ratio", - "silence_seconds": 0.5, - "speech_seconds": 0.1 - }, - "duck_while_listening": 0.3, - "energy_ratio": 1.5, - "instant_listen": false, - "mic_meter_ipc": true, - "multiplier": 1.0, - "mute_during_output": true, - "phoneme_duration": 120, - "record_wake_words": false, - "recording_timeout": 10.0, - "recording_timeout_with_silence": 3.0, - "sample_rate": 16000, - "save_utterances": false, - "wake_word_upload": { - "disable": false, - "url": "https://training.mycroft.ai/precise/upload" - } - }, - "location": { - "city": { - "code": "Lawrence", - "name": "Lawrence", - "state": { - "code": "KS", - "country": { - "code": "US", - "name": "United States" - }, - "name": "Kansas" - } - }, - "coordinate": { - "latitude": 38.971669, - "longitude": -95.23525 - }, - "timezone": { - "code": "America/Chicago", - "dstOffset": 3600000, - "name": "Central Standard Time", - "offset": -21600000 - } - }, - "network_tests": { - "dns_primary": "8.8.8.8", - "dns_secondary": "8.8.4.4", - "ncsi_endpoint": "http://www.msftncsi.com/ncsi.txt", - "ncsi_expected_text": "Microsoft NCSI", - "web_url": "https://www.google.com" - }, - "opt_in": false, - "padatious": { - "intent_cache": "~/.local/share/mycroft/intent_cache", - "padaos_only": false, - "single_thread": false, - "train_delay": 4 - }, - "play_mp3_cmdline": "mpg123 %1", - "play_ogg_cmdline": "ogg123 -q %1", - "play_wav_cmdline": "paplay %1 --stream-name=mycroft-voice", - "precise": { - "dist_url": "https://github.com/MycroftAI/precise-data/raw/dist/{arch}/latest", - "model_url": "https://raw.githubusercontent.com/MycroftAI/precise-data/models/{wake_word}.tar.gz", - "use_precise": true - }, - "ready_settings": [ - "skills" - ], - "server": { - "disabled": true, - "metrics": false, - "sync_skill_settings": true, - "update": false, - "url": "https://api.mycroft.ai", - "version": "v1" - }, - "session": { - "ttl": 180 - }, - "skills": { - "blacklisted_skills": [], - "converse": { - "converse_activation": "accept_all", - "converse_blacklist": [], - "converse_mode": "accept_all", - "converse_priorities": {}, - "converse_whitelist": [], - "cross_activation": true, - "cross_deactivation": true, - "max_activations": -1, - "skill_activations": {}, - "skill_timeouts": {}, - "timeout": 300 - }, - "directory": "skills", - "fallbacks": { - "fallback_blacklist": [], - "fallback_mode": "accept_all", - "fallback_priorities": {}, - "fallback_whitelist": [] - }, - "priority_skills": [ - "mycroft-pairing", - "mycroft-volume" - ], - "upload_skill_manifest": true, - "wait_for_internet": false - }, - "sounds": { - "acknowledge": "snd/acknowledge.mp3", - "end_listening": "snd/end_listening.wav", - "start_listening": "snd/start_listening.wav" - }, - "stt": { - "fallback_module": "ovos-stt-plugin-vosk", - "module": "ovos-stt-plugin-server", - "ovos-stt-plugin-server": { - "url": "https://stt.openvoiceos.com/stt" - } - }, - "system": { - "disable_remote_config": false, - "disable_user_config": false, - "protected_keys": { - "remote": [ - "enclosure", - "server", - "system", - "websocket", - "gui_websocket", - "network_tests", - "listener:wake_word_upload:disable", - "skills:upload_skill_manifest", - "skills:auto_update", - "skills:priority_skills", - "skills:blacklisted_skills", - "opt_in" - ], - "user": [] - } - }, - "system_unit": "metric", - "time_format": "half", - "tts": { - "fallback_module": "ovos-tts-plugin-mimic", - "module": "ovos-tts-plugin-mimic2", - "pulse_duck": false - }, - "websocket": { - "host": "0.0.0.0", - "port": 8181, - "route": "/core", - "shared_connection": true, - "ssl": false - } -} \ No newline at end of file diff --git a/test/integrationtests/configuration/mycroft.yml b/test/integrationtests/configuration/mycroft.yml deleted file mode 100644 index 6e5a41247fd6..000000000000 --- a/test/integrationtests/configuration/mycroft.yml +++ /dev/null @@ -1,193 +0,0 @@ -Audio: - backends: - OCP: - active: true - type: ovos_common_play - simple: - active: true - type: ovos_audio_simple - vlc: - active: true - type: ovos_vlc - default-backend: OCP -cache_path: /tmp/mycroft/cache -confirm_listening: true -date_format: MDY -debug: false -enclosure: - force_mycroft_ntp: true - ntp_sync_on_boot: false - platform: PHAL -gui: - extension: generic - generic: - homescreen_supported: false -gui_websocket: - base_port: 18181 - host: 0.0.0.0 - route: /gui - ssl: false -hotwords: - hey mycroft: { - "lang": "en-us", - "listen": true, - "model": "https://github.com/MycroftAI/precise-data/raw/models-dev/hey-mycroft.tar.gz", - "module": "ovos-ww-plugin-precise", - "phonemes": "HH EY . M AY K R AO F T", - "sound": "snd/start_listening.wav", - "threshold": 1.0e-90, - "version": '0.3' - } - - wake up: - # Handles the "wake up" hotword when Mycroft is sleeping - lang: en-us - module: ovos-ww-plugin-pocketsphinx - phonemes: W EY K . AH P - threshold: 1.0e-20 - wakeup: true -ignore_logs: - - enclosure.mouth.viseme - - enclosure.mouth.display -lang: en-us -listener: - VAD: - before_seconds: 0.5 - initial_energy_threshold: 1000.0 - max_current_ratio_threshold: 2 - min_seconds: 1 - module: '' - ovos-vad-plugin-silero: - threshold: 0.2 - ovos-vad-plugin-webrtcvad: - vad_mode: 3 - silence_method: vad_and_ratio - silence_seconds: 0.5 - speech_seconds: 0.1 - duck_while_listening: 0.3 - energy_ratio: 1.5 - instant_listen: false - mic_meter_ipc: true - multiplier: 1.0 - mute_during_output: true - phoneme_duration: 120 - record_wake_words: false - recording_timeout: 10.0 - recording_timeout_with_silence: 3.0 - sample_rate: 16000 - save_utterances: false - wake_word_upload: - disable: false - url: https://training.mycroft.ai/precise/upload -location: - city: - code: Lawrence - name: Lawrence - state: - code: KS - country: - code: US - name: United States - name: Kansas - coordinate: - latitude: 38.971669 - longitude: -95.23525 - timezone: - code: America/Chicago - dstOffset: 3600000 - name: Central Standard Time - offset: -21600000 -network_tests: - dns_primary: 8.8.8.8 - dns_secondary: 8.8.4.4 - ncsi_endpoint: http://www.msftncsi.com/ncsi.txt - ncsi_expected_text: Microsoft NCSI - web_url: https://www.google.com -opt_in: false -padatious: - intent_cache: ~/.local/share/mycroft/intent_cache - padaos_only: false - single_thread: false - train_delay: 4 -play_mp3_cmdline: mpg123 %1 -play_ogg_cmdline: ogg123 -q %1 -play_wav_cmdline: paplay %1 --stream-name=mycroft-voice -precise: - dist_url: https://github.com/MycroftAI/precise-data/raw/dist/{arch}/latest - model_url: https://raw.githubusercontent.com/MycroftAI/precise-data/models/{wake_word}.tar.gz - use_precise: true -ready_settings: - - skills -server: - disabled: true - metrics: false - sync_skill_settings: true - update: false - url: https://api.mycroft.ai - version: v1 -session: - ttl: 180 -skills: - blacklisted_skills: [ ] - converse: - converse_activation: accept_all - converse_blacklist: [ ] - converse_mode: accept_all - converse_priorities: { } - converse_whitelist: [ ] - cross_activation: true - cross_deactivation: true - max_activations: -1 - skill_activations: { } - skill_timeouts: { } - timeout: 300 - directory: skills - fallbacks: - fallback_blacklist: [ ] - fallback_mode: accept_all - fallback_priorities: { } - fallback_whitelist: [ ] - priority_skills: - - mycroft-pairing - - mycroft-volume - upload_skill_manifest: true - wait_for_internet: false -sounds: - acknowledge: snd/acknowledge.mp3 - end_listening: snd/end_listening.wav - start_listening: snd/start_listening.wav -stt: - fallback_module: ovos-stt-plugin-vosk - module: ovos-stt-plugin-server - ovos-stt-plugin-server: - url: https://stt.openvoiceos.com/stt -system: - disable_remote_config: false - disable_user_config: false - protected_keys: - remote: - - enclosure - - server - - system - - websocket - - gui_websocket - - network_tests - - listener:wake_word_upload:disable - - skills:upload_skill_manifest - - skills:auto_update - - skills:priority_skills - - skills:blacklisted_skills - - opt_in - user: [ ] -system_unit: metric -time_format: half -tts: - fallback_module: ovos-tts-plugin-mimic - module: ovos-tts-plugin-mimic2 - pulse_duck: false -websocket: - host: 0.0.0.0 - port: 8181 - route: /core - shared_connection: true - ssl: false diff --git a/test/integrationtests/configuration/test_configuration.py b/test/integrationtests/configuration/test_configuration.py deleted file mode 100644 index 115d3b2fe784..000000000000 --- a/test/integrationtests/configuration/test_configuration.py +++ /dev/null @@ -1,90 +0,0 @@ -import json -from os.path import dirname, isfile -from typing import OrderedDict -from unittest import TestCase -from unittest.mock import MagicMock, patch - -from ovos_config import LocalConf, RemoteConf - - -# TODO - move to ovos-config -class TestConfiguration(TestCase): - - @patch('ovos_backend_client.config.RemoteConfigManager') - @patch('ovos_backend_client.pairing.is_paired') - def test_remote(self, is_paired, config_manager): - remote_conf = {'TestConfig': True, 'uuid': 1234, - 'location': {'city': {'name': 'Stockholm'}}} - is_paired.return_value = True - - mock_api = MagicMock() - mock_api.config = remote_conf - config_manager.return_value = mock_api - - rc = RemoteConf() - rc.reload() - mock_api.download.assert_called_once() - is_paired.assert_called_once() - - self.assertTrue(rc['TestConfig']) - self.assertEqual(rc['location']['city']['name'], 'Stockholm') - - @patch('json.dump') - @patch('ovos_config.models.exists') - @patch('ovos_config.models.isfile') - @patch('ovos_config.models.load_commented_json') - def test_local(self, mock_json_loader, mock_isfile, mock_exists, - mock_json_dump): - local_conf = {'answer': 42, 'falling_objects': ['flower pot', 'whale']} - mock_exists.return_value = True - mock_isfile.return_value = True - mock_json_loader.return_value = local_conf - lc = LocalConf('test') - self.assertEqual(lc, local_conf) - - # Test merge method - merge_conf = {'falling_objects': None, 'has_towel': True} - lc.merge(merge_conf) - self.assertEqual(lc['falling_objects'], None) - self.assertEqual(lc['has_towel'], True) - - # test store - lc.store('test_conf.json') - self.assertEqual(mock_json_dump.call_args[0][0], lc) - # exists but is not file - mock_isfile.return_value = False - lc = LocalConf('test') - self.assertEqual(lc, {}) - - # does not exist - mock_exists.return_value = False - lc = LocalConf('test') - self.assertEqual(lc, {}) - - def test_file_formats(self): - yml_cnf = LocalConf(f"{dirname(__file__)}/mycroft.yml") - json_config = LocalConf(f"{dirname(__file__)}/mycroft.json") - self.assertEqual(json_config, yml_cnf) - - # test export json config as yaml - json_config.store("/tmp/not_mycroft.yml") - self.assertTrue(isfile("/tmp/not_mycroft.yml")) - test_conf = LocalConf("/tmp/not_mycroft.yml") - self.assertEqual(test_conf, yml_cnf) - self.assertEqual(test_conf, json_config) - - # test export yaml config as json - yml_cnf.store("/tmp/not_mycroft.json") - self.assertTrue(isfile("/tmp/not_mycroft.json")) - test_conf = LocalConf("/tmp/not_mycroft.json") - self.assertEqual(test_conf, yml_cnf) - self.assertEqual(test_conf, json_config) - - def test_yaml_config_load(self): - yml_cnf = LocalConf(f"{dirname(__file__)}/mycroft.yml") - for d in (yml_cnf, yml_cnf["hotwords"], - yml_cnf["hotwords"]["hey mycroft"], - yml_cnf["hotwords"]["wake up"]): - self.assertIsInstance(d, dict) - self.assertNotIsInstance(d, OrderedDict) - self.assertEqual(json.loads(json.dumps(d)), d) diff --git a/test/integrationtests/dialog/__init__.py b/test/integrationtests/dialog/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/test/integrationtests/dialog/multiple_dialogs/one.dialog b/test/integrationtests/dialog/multiple_dialogs/one.dialog deleted file mode 100644 index a2628c1e0953..000000000000 --- a/test/integrationtests/dialog/multiple_dialogs/one.dialog +++ /dev/null @@ -1 +0,0 @@ -ONE diff --git a/test/integrationtests/dialog/multiple_dialogs/two.dialog b/test/integrationtests/dialog/multiple_dialogs/two.dialog deleted file mode 100644 index 6333d309717a..000000000000 --- a/test/integrationtests/dialog/multiple_dialogs/two.dialog +++ /dev/null @@ -1 +0,0 @@ -TWO diff --git a/test/integrationtests/dialog/mustache_templates/example-context.context.json b/test/integrationtests/dialog/mustache_templates/example-context.context.json deleted file mode 100644 index 091539d7728e..000000000000 --- a/test/integrationtests/dialog/mustache_templates/example-context.context.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Chris", - "value": 10000, - "taxed_value": 6000 -} diff --git a/test/integrationtests/dialog/mustache_templates/example-context.dialog b/test/integrationtests/dialog/mustache_templates/example-context.dialog deleted file mode 100644 index aecabb10a8d9..000000000000 --- a/test/integrationtests/dialog/mustache_templates/example-context.dialog +++ /dev/null @@ -1 +0,0 @@ -Hello {{name}}, You have just won {{value}} dollars! Well, {{taxed_value}} dollars, after taxes. \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates/example-context.result b/test/integrationtests/dialog/mustache_templates/example-context.result deleted file mode 100644 index 0183799c7dc4..000000000000 --- a/test/integrationtests/dialog/mustache_templates/example-context.result +++ /dev/null @@ -1 +0,0 @@ -Hello Chris, You have just won 10000 dollars! Well, 6000 dollars, after taxes. \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates/example-simple.context.json b/test/integrationtests/dialog/mustache_templates/example-simple.context.json deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/test/integrationtests/dialog/mustache_templates/example-simple.context.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates/example-simple.dialog b/test/integrationtests/dialog/mustache_templates/example-simple.dialog deleted file mode 100644 index cd773cd131fc..000000000000 --- a/test/integrationtests/dialog/mustache_templates/example-simple.dialog +++ /dev/null @@ -1 +0,0 @@ -Hello there! \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates/example-simple.result b/test/integrationtests/dialog/mustache_templates/example-simple.result deleted file mode 100644 index cd773cd131fc..000000000000 --- a/test/integrationtests/dialog/mustache_templates/example-simple.result +++ /dev/null @@ -1 +0,0 @@ -Hello there! \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates_comments/example-comments.dialog b/test/integrationtests/dialog/mustache_templates_comments/example-comments.dialog deleted file mode 100644 index 114efa33e938..000000000000 --- a/test/integrationtests/dialog/mustache_templates_comments/example-comments.dialog +++ /dev/null @@ -1,2 +0,0 @@ -# This is a commented line -This is a line without comment diff --git a/test/integrationtests/dialog/mustache_templates_comments/example-comments.result b/test/integrationtests/dialog/mustache_templates_comments/example-comments.result deleted file mode 100644 index 30246649ead5..000000000000 --- a/test/integrationtests/dialog/mustache_templates_comments/example-comments.result +++ /dev/null @@ -1 +0,0 @@ -This is a line without comment diff --git a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.context.json b/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.context.json deleted file mode 100644 index 1fd6fbf5b530..000000000000 --- a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.context.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "Sherlock" -} \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.dialog b/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.dialog deleted file mode 100644 index 70d5611ca410..000000000000 --- a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.dialog +++ /dev/null @@ -1,3 +0,0 @@ -Hello there {{name}}! -Another possible outcome, {{name}} -Oh, {{name}} look at the capabilities \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.result b/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.result deleted file mode 100644 index ea3370bbfa8b..000000000000 --- a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple-context.result +++ /dev/null @@ -1,3 +0,0 @@ -Hello there Sherlock! -Another possible outcome, Sherlock -Oh, Sherlock look at the capabilities diff --git a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.context.json b/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.context.json deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.context.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.dialog b/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.dialog deleted file mode 100644 index 2f0581807c60..000000000000 --- a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.dialog +++ /dev/null @@ -1,3 +0,0 @@ -Hello there! -Another possible outcome -Oh look at the capabilities \ No newline at end of file diff --git a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.result b/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.result deleted file mode 100644 index 267860fd3c6b..000000000000 --- a/test/integrationtests/dialog/mustache_templates_multiple/example-multiple.result +++ /dev/null @@ -1,3 +0,0 @@ -Hello there! -Another possible outcome -Oh look at the capabilities diff --git a/test/integrationtests/dialog/test_dialog.py b/test/integrationtests/dialog/test_dialog.py deleted file mode 100644 index f2c1d7bb23a7..000000000000 --- a/test/integrationtests/dialog/test_dialog.py +++ /dev/null @@ -1,104 +0,0 @@ -# -# Copyright 2017 Mycroft AI Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import json -import pathlib -import unittest - -from ovos_utils.dialog import MustacheDialogRenderer, load_dialogs - - -# TODO - move to ovos-utils -class DialogTest(unittest.TestCase): - def setUp(self): - self.stache = MustacheDialogRenderer() - self.topdir = pathlib.Path(__file__).parent - - def test_general_dialog(self): - """ Test the loading and filling of valid simple mustache dialogs """ - template_path = self.topdir.joinpath('./mustache_templates') - for file in template_path.iterdir(): - if file.suffix == '.dialog': - self.stache.load_template_file(file.name, str(file.absolute())) - context = json.load( - file.with_suffix('.context.json').open( - 'r', encoding='utf-8')) - self.assertEqual( - self.stache.render(file.name, context), - file.with_suffix('.result').open('r', - encoding='utf-8').read()) - - def test_unknown_dialog(self): - """ Test for returned file name literals in case of unkown dialog """ - self.assertEqual( - self.stache.render("unknown.template"), "unknown template") - - def test_multiple_dialog(self): - """ - Test the loading and filling of valid mustache dialogs - where a dialog file contains multiple text versions - """ - template_path = self.topdir.joinpath('./mustache_templates_multiple') - for file in template_path.iterdir(): - if file.suffix == '.dialog': - self.stache.load_template_file(file.name, str(file.absolute())) - context = json.load( - file.with_suffix('.context.json').open( - 'r', encoding='utf-8')) - results = [ - line.strip() for line in file.with_suffix('.result').open( - 'r', encoding='utf-8') - ] - # Try all lines - for index, line in enumerate(results): - self.assertEqual( - self.stache.render( - file.name, index=index, context=context), - line.strip()) - # Test random index function - # (bad test because non-deterministic?) - self.assertIn( - self.stache.render(file.name, context=context), results) - - def test_comment_dialog(self): - """ - Test the loading and filling of valid mustache dialogs - where a dialog file contains multiple text versions - """ - template_path = self.topdir.joinpath('./mustache_templates_comments') - for f in template_path.iterdir(): - if f.suffix == '.dialog': - self.stache.load_template_file(f.name, str(f.absolute())) - results = [line.strip() - for line in f.with_suffix('.result').open('r')] - # Try all lines - for index, line in enumerate(results): - self.assertEqual(self.stache.render(f.name, index=index), - line.strip()) - - def test_dialog_loader(self): - template_path = self.topdir.joinpath('./multiple_dialogs') - renderer = load_dialogs(template_path) - self.assertEqual(renderer.render('one'), 'ONE') - self.assertEqual(renderer.render('two'), 'TWO') - - def test_dialog_loader_missing(self): - template_path = self.topdir.joinpath('./missing_dialogs') - renderer = load_dialogs(template_path) - self.assertEqual(renderer.render('test'), 'test') - - -if __name__ == "__main__": - unittest.main() diff --git a/test/integrationtests/intent_file/vocab/en-us/test.intent b/test/integrationtests/intent_file/vocab/en-us/test.intent deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/test/integrationtests/intent_file/vocab/en-us/test_ent.entity b/test/integrationtests/intent_file/vocab/en-us/test_ent.entity deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/test/integrationtests/locale/en-us/turn_off2_test.voc b/test/integrationtests/locale/en-us/turn_off2_test.voc deleted file mode 100644 index d06334097793..000000000000 --- a/test/integrationtests/locale/en-us/turn_off2_test.voc +++ /dev/null @@ -1 +0,0 @@ -(turn off|switch off) diff --git a/test/integrationtests/locale/en-us/turn_off_test.voc b/test/integrationtests/locale/en-us/turn_off_test.voc deleted file mode 100644 index 8dde42090206..000000000000 --- a/test/integrationtests/locale/en-us/turn_off_test.voc +++ /dev/null @@ -1,3 +0,0 @@ -turn off -switch off - diff --git a/test/integrationtests/test_audioservice.py b/test/integrationtests/test_audioservice.py deleted file mode 100644 index c2a69cca86d3..000000000000 --- a/test/integrationtests/test_audioservice.py +++ /dev/null @@ -1,177 +0,0 @@ -from unittest import TestCase, mock - -# TODO - move test to ovos-bus-client -from ovos_bus_client.message import Message -from ovos_bus_client.apis.ocp import ClassicAudioServiceInterface as AudioService - - -class TestAudioServiceControls(TestCase): - def assertLastMessageTypeEqual(self, bus, msg_type): - message = bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, msg_type) - - def setUp(self): - self.bus = mock.Mock(name='bus') - self.audioservice = AudioService(self.bus) - - def test_pause(self): - self.audioservice.pause() - self.assertLastMessageTypeEqual(self.bus, - 'mycroft.audio.service.pause') - - def test_resume(self): - self.audioservice.resume() - self.assertLastMessageTypeEqual(self.bus, - 'mycroft.audio.service.resume') - - def test_next(self): - self.audioservice.next() - self.assertLastMessageTypeEqual(self.bus, 'mycroft.audio.service.next') - - def test_prev(self): - self.audioservice.prev() - self.assertLastMessageTypeEqual(self.bus, 'mycroft.audio.service.prev') - - def test_stop(self): - self.audioservice.stop() - self.assertLastMessageTypeEqual(self.bus, 'mycroft.audio.service.stop') - - def test_seek(self): - self.audioservice.seek() - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, - 'mycroft.audio.service.seek_forward') - self.assertEqual(message.data['seconds'], 1) - self.audioservice.seek(5) - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, - 'mycroft.audio.service.seek_forward') - self.assertEqual(message.data['seconds'], 5) - self.audioservice.seek(-5) - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, - 'mycroft.audio.service.seek_backward') - self.assertEqual(message.data['seconds'], 5) - - -class TestAudioServicePlay(TestCase): - def setUp(self): - self.bus = mock.Mock(name='bus') - self.audioservice = AudioService(self.bus) - - def test_proper_uri(self): - self.audioservice.play('file:///hello_nasty.mp3') - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, 'mycroft.audio.service.play') - self.assertEqual(message.data['tracks'], ['file:///hello_nasty.mp3']) - self.assertEqual(message.data['repeat'], False) - - def test_path(self): - self.audioservice.play('/hello_nasty.mp3') - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, 'mycroft.audio.service.play') - self.assertEqual(message.data['tracks'], ['file:///hello_nasty.mp3']) - self.assertEqual(message.data['repeat'], False) - - def test_tuple(self): - """Test path together with mimetype.""" - self.audioservice.play(('/hello_nasty.mp3', 'audio/mp3')) - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, 'mycroft.audio.service.play') - self.assertEqual(message.data['tracks'], - [('file:///hello_nasty.mp3', 'audio/mp3')]) - self.assertEqual(message.data['repeat'], False) - - def test_invalid(self): - """Test play request with invalid type.""" - with self.assertRaises(ValueError): - self.audioservice.play(12) - - def test_extra_arguments(self): - """Test sending along utterance and setting repeat.""" - self.audioservice.play('/hello_nasty.mp3', 'on vlc', True) - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, 'mycroft.audio.service.play') - self.assertEqual(message.data['tracks'], ['file:///hello_nasty.mp3']) - self.assertEqual(message.data['repeat'], True) - self.assertEqual(message.data['utterance'], 'on vlc') - - -class TestAudioServiceQueue(TestCase): - def setUp(self): - self.bus = mock.Mock(name='bus') - self.audioservice = AudioService(self.bus) - - def test_uri(self): - self.audioservice.queue('file:///hello_nasty.mp3') - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, 'mycroft.audio.service.queue') - self.assertEqual(message.data['tracks'], ['file:///hello_nasty.mp3']) - - def test_path(self): - self.audioservice.queue('/hello_nasty.mp3') - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, 'mycroft.audio.service.queue') - self.assertEqual(message.data['tracks'], ['file:///hello_nasty.mp3']) - - def test_tuple(self): - self.audioservice.queue(('/hello_nasty.mp3', 'audio/mp3')) - message = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(message.msg_type, 'mycroft.audio.service.queue') - self.assertEqual(message.data['tracks'], - [('file:///hello_nasty.mp3', 'audio/mp3')]) - - def test_invalid(self): - with self.assertRaises(ValueError): - self.audioservice.queue(12) - - -class TestAudioServiceMisc(TestCase): - def test_lifecycle(self): - bus = mock.Mock(name='bus') - audioservice = AudioService(bus) - self.assertEqual(audioservice.bus, bus) - - def test_available_backends(self): - bus = mock.Mock(name='bus') - audioservice = AudioService(bus) - - available_backends = { - 'simple': { - 'suported_uris': ['http', 'file'], - 'default': True, - 'remote': False - } - } - bus.wait_for_response.return_value = Message('test_msg', - available_backends) - response = audioservice.available_backends() - self.assertEqual(available_backends, response) - # Check no response behaviour - bus.wait_for_response.return_value = None - response = audioservice.available_backends() - self.assertEqual({}, response) - - def test_track_info(self): - """Test is_playing property.""" - bus = mock.Mock(name='bus') - audioservice = AudioService(bus) - info = {'album': 'Hello Nasty', - 'artist': 'Beastie Boys', - 'name': 'Intergalactic' - } - bus.wait_for_response.return_value = Message('test_msg', info) - self.assertEqual(audioservice.track_info(), info) - bus.wait_for_response.return_value = None - self.assertEqual(audioservice.track_info(), {}) - - def test_is_playing(self): - """Test is_playing property.""" - bus = mock.Mock(name='bus') - audioservice = AudioService(bus) - audioservice.track_info = mock.Mock() - - audioservice.track_info.return_value = {'track': 'one cool song'} - self.assertTrue(audioservice.is_playing) - audioservice.track_info.return_value = {} - self.assertFalse(audioservice.is_playing) diff --git a/test/integrationtests/test_common_play_skill.py b/test/integrationtests/test_common_play_skill.py deleted file mode 100644 index 85fa9c2c3032..000000000000 --- a/test/integrationtests/test_common_play_skill.py +++ /dev/null @@ -1,143 +0,0 @@ -from unittest import TestCase, mock - -from ovos_bus_client.message import Message -from ovos_bus_client.apis.ocp import ClassicAudioServiceInterface as AudioService - -# TODO - mycroft_legacy -from mycroft.skills.common_play_skill import CommonPlaySkill, CPSMatchLevel - - -class AnyCallable: - """Class matching any callable. - - Useful for assert_called_with arguments. - """ - def __eq__(self, other): - return callable(other) - - - -class TestCommonPlay(TestCase): - def setUp(self): - self.skill = CPSTest() - self.bus = mock.Mock(name='bus') - self.skill.bind(self.bus) - self.audioservice = mock.Mock(name='audioservice') - self.skill.audioservice = self.audioservice - - def test_lifecycle(self): - skill = CPSTest() - bus = mock.Mock(name='bus') - skill.bind(bus) - self.assertTrue(isinstance(skill.audioservice, AudioService)) - bus.on.assert_any_call('play:query', AnyCallable()) - bus.on.assert_any_call('play:start', AnyCallable()) - skill.shutdown() - - def test_handle_start_playback(self): - """Test common play start method.""" - self.skill.audioservice.is_playing = True - start_playback = self.bus.on.call_args_list[-1][0][1] - - phrase = 'Don\'t open until doomsday' - start_playback(Message('play:start', data={'phrase': phrase, - 'skill_id': 'asdf'})) - self.skill.CPS_start.assert_not_called() - - self.bus.emit.reset_mock() - start_playback(Message('play:start', - data={'phrase': phrase, - 'skill_id': self.skill.skill_id})) - self.audioservice.stop.assert_called_once_with() - self.skill.CPS_start.assert_called_once_with(phrase, None) - - def test_cps_play(self): - """Test audioservice play helper.""" - self.skill.play_service_string = 'play on godzilla' - self.skill.CPS_play(['looking_for_freedom.mp3'], - utterance='play on mothra') - self.audioservice.play.assert_called_once_with( - ['looking_for_freedom.mp3'], utterance='play on mothra') - - self.audioservice.play.reset_mock() - # Assert that the utterance is injected - self.skill.CPS_play(['looking_for_freedom.mp3']) - self.audioservice.play.assert_called_once_with( - ['looking_for_freedom.mp3'], utterance='play on godzilla') - - def test_stop(self): - """Test default reaction to stop command.""" - self.audioservice.is_playing = False - self.assertFalse(self.skill.stop()) - - self.audioservice.is_playing = True - self.assertTrue(self.skill.stop()) - - -class TestCPSQuery(TestCase): - def setUp(self): - self.skill = CPSTest() - self.bus = mock.Mock(name='bus') - self.skill.bind(self.bus) - self.audioservice = mock.Mock(name='audioservice') - self.skill.audioservice = self.audioservice - self.query_phrase = self.bus.on.call_args_list[-2][0][1] - - def test_handle_play_query_no_match(self): - """Test common play match when no match is found.""" - - # Check Not matching queries - self.skill.CPS_match_query_phrase.return_value = None - self.query_phrase(Message('play:query', - data={'phrase': 'Monster mash'})) - - # Check that the skill replied that it was searching - extension = self.bus.emit.call_args_list[-2][0][0] - self.assertEqual(extension.data['phrase'], 'Monster mash') - self.assertEqual(extension.data['skill_id'], self.skill.skill_id) - self.assertEqual(extension.data['searching'], True) - - # Assert that the skill reported that it couldn't find the phrase - response = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(response.data['phrase'], 'Monster mash') - self.assertEqual(response.data['skill_id'], self.skill.skill_id) - self.assertEqual(response.data['searching'], False) - - def test_play_query_match(self): - """Test common play match when a match is found.""" - phrase = 'Don\'t open until doomsday' - self.skill.CPS_match_query_phrase.return_value = (phrase, - CPSMatchLevel.TITLE) - self.query_phrase(Message('play:query', - data={'phrase': phrase})) - # Assert that the skill reported the correct confidence - response = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(response.data['phrase'], phrase) - self.assertEqual(response.data['skill_id'], self.skill.skill_id) - self.assertAlmostEqual(response.data['conf'], 0.85) - - # Partial phrase match - self.skill.CPS_match_query_phrase.return_value = ('until doomsday', - CPSMatchLevel.TITLE) - self. query_phrase(Message('play:query', - data={'phrase': phrase})) - # Assert that the skill reported the correct confidence - response = self.bus.emit.call_args_list[-1][0][0] - self.assertEqual(response.data['phrase'], phrase) - self.assertEqual(response.data['skill_id'], self.skill.skill_id) - self.assertAlmostEqual(response.data['conf'], 0.825) - - -class CPSTest(CommonPlaySkill): - """Simple skill for testing the CommonPlaySkill""" - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.CPS_match_query_phrase = mock.Mock(name='match_phrase') - self.CPS_start = mock.Mock(name='start_playback') - self.skill_id = 'CPSTest' - - def CPS_match_query_phrase(self, phrase): - pass - - def CPS_start(self, data): - pass diff --git a/test/integrationtests/test_event_container.py b/test/integrationtests/test_event_container.py deleted file mode 100644 index 8874eb5b7abd..000000000000 --- a/test/integrationtests/test_event_container.py +++ /dev/null @@ -1,68 +0,0 @@ -import unittest -from unittest import mock -from ovos_utils.events import EventContainer - - -def example_handler(message): - pass - -# TODO - move to ovos-utils -class TestEventContainer(unittest.TestCase): - def test_init(self): - bus = mock.MagicMock() - - # Set bus via init - container = EventContainer(bus) - self.assertEqual(container.bus, bus) - - # Set bus using .set_bus - container = EventContainer(None) - self.assertIsNotNone(container.bus) - container.set_bus(bus) - self.assertEqual(container.bus, bus) - - def test_add(self): - bus = mock.MagicMock() - container = EventContainer(bus) - self.assertEqual(len(container.events), 0) - - # Test add normal event handler - container.add('test1', example_handler) - self.assertTrue(bus.on.called) - - # Test add single shot event handler - len_before = len(container.events) - container.add('test2', example_handler, once=True) - self.assertEqual(len_before + 1, len(container.events)) - self.assertTrue(bus.once.called) - - # Verify correct content in event container - self.assertTrue(('test1', example_handler) in container.events) - self.assertEqual(len(container.events), 2) - - def test_remove(self): - bus = mock.MagicMock() - container = EventContainer(bus) - self.assertEqual(len(container.events), 0) - - container.add('test1', example_handler) - container.add('test2', example_handler) - container.add('test3', example_handler) - self.assertEqual(len(container.events), 3) - - self.assertTrue(('test2', example_handler) in container.events) - container.remove('test2') - self.assertTrue(('test2', example_handler) not in container.events) - self.assertTrue(bus.remove_all_listeners.called) - - def test_clear(self): - bus = mock.MagicMock() - container = EventContainer(bus) - - container.add('test1', example_handler) - container.add('test2', example_handler) - container.add('test3', example_handler) - self.assertEqual(len(container.events), 3) - - container.clear() - self.assertEqual(len(container.events), 0) diff --git a/test/integrationtests/test_event_scheduler.py b/test/integrationtests/test_event_scheduler.py deleted file mode 100644 index 8c2680363c34..000000000000 --- a/test/integrationtests/test_event_scheduler.py +++ /dev/null @@ -1,124 +0,0 @@ -""" - Test cases regarding the event scheduler. -""" - -import unittest -import time -from pyee import ExecutorEventEmitter - -from unittest.mock import MagicMock, patch -from ovos_utils.messagebus import FakeBus -from ovos_bus_client.util.scheduler import EventScheduler, EventSchedulerInterface - - -# TODO - move to ovos-bus-client -class TestEventScheduler(unittest.TestCase): - @patch('threading.Thread') - @patch('json.load') - @patch('json.dump') - @patch('builtins.open') - def test_create(self, mock_open, mock_json_dump, mock_load, mock_thread): - """ - Test creating and shutting down event_scheduler. - """ - mock_load.return_value = '' - mock_open.return_value = MagicMock() - emitter = MagicMock() - es = EventScheduler(emitter) - es.shutdown() - self.assertEqual(mock_json_dump.call_args[0][0], {}) - - @patch('threading.Thread') - @patch('json.load') - @patch('json.dump') - @patch('builtins.open') - def test_add_remove(self, mock_open, mock_json_dump, - mock_load, mock_thread): - """ - Test add an event and then remove it. - """ - # Thread start is mocked so will not actually run the thread loop - mock_load.return_value = '' - mock_open.return_value = MagicMock() - emitter = MagicMock() - es = EventScheduler(emitter) - - # 900000000000 should be in the future for a long time - es.schedule_event('test', 90000000000, None) - es.schedule_event('test-2', 90000000000, None) - - es.check_state() # run one cycle - self.assertTrue('test' in es.events) - self.assertTrue('test-2' in es.events) - - es.remove_event('test') - es.check_state() # run one cycle - self.assertTrue('test' not in es.events) - self.assertTrue('test-2' in es.events) - es.shutdown() - - @patch('threading.Thread') - @patch('json.load') - @patch('json.dump') - @patch('builtins.open') - def test_save(self, mock_open, mock_dump, mock_load, mock_thread): - """ - Test save functionality. - """ - mock_load.return_value = '' - mock_open.return_value = MagicMock() - emitter = MagicMock() - es = EventScheduler(emitter) - - # 900000000000 should be in the future for a long time - es.schedule_event('test', 900000000000, None) - es.schedule_event('test-repeat', 910000000000, 60) - es.check_state() - - es.shutdown() - - # Make sure the dump method wasn't called with test-repeat - self.assertEqual(mock_dump.call_args[0][0], - {'test': [(900000000000, None, {}, None)]}) - - @patch('threading.Thread') - @patch('json.load') - @patch('json.dump') - @patch('builtins.open') - def test_send_event(self, mock_open, mock_dump, mock_load, mock_thread): - """ - Test save functionality. - """ - mock_load.return_value = '' - mock_open.return_value = MagicMock() - emitter = MagicMock() - es = EventScheduler(emitter) - - # 0 should be in the future for a long time - es.schedule_event('test', time.time(), None) - - es.check_state() - self.assertEqual(emitter.emit.call_args[0][0].msg_type, 'test') - self.assertEqual(emitter.emit.call_args[0][0].data, {}) - es.shutdown() - - -class TestEventSchedulerInterface(unittest.TestCase): - def test_shutdown(self): - def f(message): - print('TEST FUNC') - - bus = ExecutorEventEmitter() - - es = EventSchedulerInterface('tester') - es.set_bus(FakeBus()) - es.set_id('id') - - # Schedule a repeating event - es.schedule_repeating_event(f, None, 10, name='f') - self.assertTrue(len(es.bus.ee._events['id:f']) == 1) - - es.shutdown() - # Check that the reference to the function has been removed from the - # bus emitter - self.assertTrue(len(bus._events['id:f']) == 0) diff --git a/test/integrationtests/test_lock.py b/test/integrationtests/test_lock.py deleted file mode 100644 index 2816ce1e1432..000000000000 --- a/test/integrationtests/test_lock.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2017 Mycroft AI Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import signal -import unittest -from shutil import rmtree - -from unittest.mock import patch -import os -from os.path import exists, isfile - -from ovos_utils.process_utils import PIDLock as Lock -from ovos_utils.file_utils import get_temp_path -from ovos_config.meta import get_xdg_base - - -class TestLock(unittest.TestCase): - def setUp(self): - if exists(get_temp_path(get_xdg_base())): - rmtree(get_temp_path(get_xdg_base())) - - def test_create_lock(self): - l1 = Lock('test') - self.assertTrue( - isfile(get_temp_path(get_xdg_base(), 'test.pid'))) - - def test_delete_lock(self): - l1 = Lock('test') - self.assertTrue( - isfile(get_temp_path(get_xdg_base(), 'test.pid'))) - l1.delete() - self.assertFalse( - isfile(get_temp_path(get_xdg_base(), 'test.pid'))) - - @patch('os.kill') - def test_existing_lock(self, mock_kill): - """ Test that an existing lock will kill the old pid. """ - l1 = Lock('test') - self.assertTrue( - isfile(get_temp_path(get_xdg_base(), 'test.pid'))) - l2 = Lock('test2') - self.assertFalse(mock_kill.called) - l2 = Lock('test') - self.assertTrue(mock_kill.called) - - def test_keyboard_interrupt(self): - l1 = Lock('test') - self.assertTrue( - isfile(get_temp_path(get_xdg_base(), 'test.pid'))) - try: - os.kill(os.getpid(), signal.SIGINT) - except KeyboardInterrupt: - pass - self.assertFalse( - isfile(get_temp_path(get_xdg_base(), 'test.pid'))) - - -if __name__ == '__main__': - unittest.main() diff --git a/test/integrationtests/test_selene_api.py b/test/integrationtests/test_selene_api.py index f063af1a2b0e..79641b30b447 100644 --- a/test/integrationtests/test_selene_api.py +++ b/test/integrationtests/test_selene_api.py @@ -19,6 +19,8 @@ import ovos_backend_client.pairing from unittest.mock import MagicMock, patch +# TODO - move test to ovos-backend.client + ovos_backend_client.backends.base.requests.post = MagicMock() diff --git a/test/integrationtests/translate/in-dialog/dialog/en-us/good_things.list b/test/integrationtests/translate/in-dialog/dialog/en-us/good_things.list deleted file mode 100644 index 78a4efa0eb0d..000000000000 --- a/test/integrationtests/translate/in-dialog/dialog/en-us/good_things.list +++ /dev/null @@ -1,3 +0,0 @@ -sunshine -mycroft -licorice diff --git a/test/integrationtests/translate/in-dialog/dialog/en-us/named_things.value b/test/integrationtests/translate/in-dialog/dialog/en-us/named_things.value deleted file mode 100644 index 5e44c5cc065d..000000000000 --- a/test/integrationtests/translate/in-dialog/dialog/en-us/named_things.value +++ /dev/null @@ -1,4 +0,0 @@ -dot,0 -line,1 -circle,2 -ball,3 diff --git a/test/integrationtests/translate/in-dialog/dialog/en-us/test.template b/test/integrationtests/translate/in-dialog/dialog/en-us/test.template deleted file mode 100644 index 8a6a6b8477c5..000000000000 --- a/test/integrationtests/translate/in-dialog/dialog/en-us/test.template +++ /dev/null @@ -1 +0,0 @@ -Oh look it's my favourite {thing} diff --git a/test/integrationtests/translate/in-locale/locale/de-de/good_things.list b/test/integrationtests/translate/in-locale/locale/de-de/good_things.list deleted file mode 100644 index 1ca068048fbd..000000000000 --- a/test/integrationtests/translate/in-locale/locale/de-de/good_things.list +++ /dev/null @@ -1,3 +0,0 @@ -sonne -mycroft -zahne diff --git a/test/integrationtests/translate/in-locale/locale/de-de/named_things.value b/test/integrationtests/translate/in-locale/locale/de-de/named_things.value deleted file mode 100644 index 3d7ac3247568..000000000000 --- a/test/integrationtests/translate/in-locale/locale/de-de/named_things.value +++ /dev/null @@ -1,3 +0,0 @@ -gelb,0 -rot,1 -blau,2 diff --git a/test/integrationtests/translate/in-locale/locale/de-de/test.template b/test/integrationtests/translate/in-locale/locale/de-de/test.template deleted file mode 100644 index c7d26b08efac..000000000000 --- a/test/integrationtests/translate/in-locale/locale/de-de/test.template +++ /dev/null @@ -1 +0,0 @@ -Aber setzen sie sich herr {thing} diff --git a/test/integrationtests/translate/in-locale/locale/en-us/good_things.list b/test/integrationtests/translate/in-locale/locale/en-us/good_things.list deleted file mode 100644 index 78a4efa0eb0d..000000000000 --- a/test/integrationtests/translate/in-locale/locale/en-us/good_things.list +++ /dev/null @@ -1,3 +0,0 @@ -sunshine -mycroft -licorice diff --git a/test/integrationtests/translate/in-locale/locale/en-us/named_things.value b/test/integrationtests/translate/in-locale/locale/en-us/named_things.value deleted file mode 100644 index 5e44c5cc065d..000000000000 --- a/test/integrationtests/translate/in-locale/locale/en-us/named_things.value +++ /dev/null @@ -1,4 +0,0 @@ -dot,0 -line,1 -circle,2 -ball,3 diff --git a/test/integrationtests/translate/in-locale/locale/en-us/not_in_german.list b/test/integrationtests/translate/in-locale/locale/en-us/not_in_german.list deleted file mode 100644 index 5755f36c6661..000000000000 --- a/test/integrationtests/translate/in-locale/locale/en-us/not_in_german.list +++ /dev/null @@ -1,3 +0,0 @@ -not -in -German diff --git a/test/integrationtests/translate/in-locale/locale/en-us/test.template b/test/integrationtests/translate/in-locale/locale/en-us/test.template deleted file mode 100644 index 8a6a6b8477c5..000000000000 --- a/test/integrationtests/translate/in-locale/locale/en-us/test.template +++ /dev/null @@ -1 +0,0 @@ -Oh look it's my favourite {thing} diff --git a/test/unittests/test_skill/__init__.py b/test/unittests/test_skill/__init__.py index ad2e096de486..eb13df00d97c 100644 --- a/test/unittests/test_skill/__init__.py +++ b/test/unittests/test_skill/__init__.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from ovos_workshop.skills.mycroft_skill import MycroftSkill +from ovos_workshop.skills.ovos import OVOSSkill -class LoadTestSkill(MycroftSkill): +class LoadTestSkill(OVOSSkill): pass