Forcing all content to string limits the amount of tests that can be run with this. For example a list of strings will fail. This keeps the original type from the json
Adds the possibility to add a responses list in the test case. The test
will respond with each of the entries in the list to get_response
requests.
Ex:
{
[...]
"responses": ["yes", "Miami"]
}
expected_data would fail in combination with Intent tests, this
differentiates it from the other rules
Add message type as "__type__" in the data for processing using
expected_data.
The custom test runner can be used for mocking third-party applications
or services.
To use create a __init__.py in the SKILL_DIR/test
The base of the file should look something like:
```python
from test.integrationtests.skills.skill_tester import SkillTest
def skill_runner(skill, example, emitter, loader, m1, m2):
return SkillTest(skill, example, emitter).run(loader)
```
Then the skill_runner can be decorated by `mock.patch` to mock out resources.
Allows the intent test to check expected data content.
Example:
{
"utterance": "set a weekend alarm at 9 am",
"expected_data": {
"ampm": "am",
"time": "9",
"daytype": "weekend"
},
"expected_response": "Okay. Setting a .* alarm"
}
Rule is satisfied if the entry exists in the data field not taking into
account it's value at all:
Example:
{
"utterance": "set an alarm on july 4th 2016 at 3pm",
"evaluation_timeout": 10,
"assert": "[['and', ['exists', 'ampm'], ['exists', 'time'] ]]"
}
Minimum viable solution for running existing testcases (json files).
Currently considered additions:
(16, 3) # TODO: Make template for testing one skill only, for the skill
developer to use
(138, 11) # TODO: Pass something to intent, that tells that this is a
test run. The skill intent can then avoid side effects
(144, 11) # TODO: add optional timeout parameter to test_case
(155, 11) # TODO: Check that all intents are checked (what about
context)
(169, 3) # TODO: Add command line utility to test an event against a
test_case, allow for debugging tests
(173, 11) # TODO: Add support for expected response, and others
This is necessary because in Python 3, hash(x) changes every single start of the application. Using the skill folder makes it consistent. In addition, the skill folder makes it easier to debug parts of the application in comparison to using something like an md5sum
Lots of minor fixes including, sorting dicts, making ints of strings,
MagicMock file spec and some other things
A couple of issues in the mycroft-core code base were identified and
fixed. Most notably the incorrect version check for python three when
adding basestring.
Update .travis.yml
- Engines now specify if they support ssml rather than the configuration
- The text client strips out ssml tags
- Engines can modify tags via the `self.modify_tag` method
* Fix error message for enable_intent
The error was printed for each intent name mismatch instead of after all intents had been checked.
* Make sure intents aren't munged multiple times
Previously intents could be munged multiple times (This happened when enabling a disabled intent), resulting in an invalid name.
* Add test case for disable/enable intent
* Improve unmunging of messages
This make sure that only skill id's in the beginning of messages are removed and should speed up the process slightly
* Fix munging for register_vocab and register_regex
* Add testcases for register vocab and regex
Add support for:
* mycroft.util.format.nice_time()
* mycroft.util.format.prounce_number()
* implemented unittests for above
Also renamed the helper method convert_number() to
_convert_to_mixed_fraction()
- add_event() now accepts the parameter once, registring the event as a one shot event.
- remove_event for non-existing events is handled
- added a test for this
Move the language specific functions and constants into separate files.
This will avoid many unnecessary conflicts due to involuntary encoding
changes.
When a token has been generated for the provided developer credentials
id the method will return it as json, if it doesn't exist HTTPError will
be raised (404 not found)
Previously the coverage counted the entire mycroft core including things
such as the docs and the tests themself. The inclusion of the actual
tests in the coverage metric scewed the metric quite a bit and the
inclusion of irrelevant files made the information presented by
coveralls cluttered.
As noted on the Chromium Dev How-to [1] and on the
SpeechRecognition library docs [2], the Google TTS API
is really not the right API to call. While it's simple,
and allows you to authenticate via a simple token, it is
also limited to a max of *50* requests per day.
That's not a lot. I don't think many people will find that
useful, outside of quick testing (if they can even get an
API key - I couldn't figure out how to generate one that
worked correctly).
This commit introduces a new STT backend, google_cloud, so that
the Google STT backend can be deprecated eventually. To do so, we
needed to:
- Install the Google API Client Library
- Create a new STT class which knows how to turn a provided Google
JSON credentials file into a string (the SpeechRecognition library
expects you to pass in the JSON string, not a file path, nor an object).
Any person wishing to use this will need to:
- Enable the Cloud Speech API on the Google Cloud Platform console
- Create a new Service Account Key, and download the credentials to
a secure location
- Configure that location in mycroft.conf, like so:
"stt": {
"google_cloud": {
"credential" {
"json": { contents of downloaded credentials }
}
}
}
It's worth noting that the Cloud Speech API has a free quota of
60 minutes per month, which would probably stretch further than 50
individual requests. So for hobbyists, it should be nothing but
a net benefit.
[1] http://www.chromium.org/developers/how-tos/api-keys
[2] https://github.com/Uberi/speech_recognition/blob/master/reference/library-reference.rst#recognizer_instancerecognize_googleaudio_data-key--none-language--en-us-show_all--false
PR 1049 introduced several cosmetic PEP8 errors that were easily fixed.
Additionally there are unittests that include non-ASCII characters which are
failing. As Pt-PT support is a work-in-progress, I just commented them out
with TODOs next to them.
==== Tech Notes ====
- removed old main.py
- replace reference to ConfigurationManager in api tests
- reset configuration after use in configuration test
- Pep-8 issue
added capability to auto upload changes from settingsmeta.json to home.mycroft.ai
==== Documentation Notes ====
If a developer make changes to the settingsmeta.json, then this will be auto uploaded to home.mycroft.ai
==== Protocol Notes ====
hash and uuid are now stored as variables in files located in ~/.mycroft/skills/{skill-name}
This commit officially switches the mycroft-core repository from
GPLv3.0 licensing to Apache 2.0. All dependencies on GPL'ed code
have been removed and we have contacted all previous contributors
with still-existing code in the repository to agree to this change.
Going forward, all contributors will sign a Contributor License
Agreement (CLA) by visiting https://mycroft.ai/cla, then they will
be included in the Mycroft Project's overall Contributor list,
found at: https://github.com/MycroftAI/contributors. This cleanly
protects the project, the contributor and all who use the technology
to build upon.
Futher discussion can be found at this blog post:
https://mycroft.ai/blog/right-license/
This commit also removes all __author__="" from the code. These
lines are painful to maintain and the etiquette surrounding their
maintainence is unclear. Do you remove a name from the list if the
last line of code the wrote gets replaced? Etc. Now all
contributors are publicly acknowledged in the aforementioned repo,
and actual authorship is maintained by Github in a much more
effective and elegant way!
Finally, a few references to "Mycroft AI" were changed to the correct
legal entity name "Mycroft AI Inc."
==== Fixed Issues ====
#403 Update License.md and file headers to Apache 2.0
#400 Update LICENSE.md
==== Documentation Notes ====
Deprecated the ScheduledSkill and ScheduledCRUDSkill classes.
These capabilities have been superceded by the more flexible MycroftSkill
class methods schedule_event(), schedule_repeating_event(), update_event(),
and cancel_event().
==== Tech Notes ====
Some functions have been orphaned in core.py and are only used in the
tests. To clean up these have been moved to where they're used.
==== Fixed Issues ====
NONE - replace with associated issue numbers, e.g. #123, #304
==== Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.
==== Documentation Notes ====
NONE - description of a new feature or notes on behavior changes
==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.
==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.
==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
==== Fixed Issues ====
NONE - replace with associated issue numbers, e.g. #123, #304
==== Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.
==== Documentation Notes ====
NONE - description of a new feature or notes on behavior changes
==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.
==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.
==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
This is just a basic test of sending between websocket clients. It makes sure the message gets to the other side. It doesn't check for correct ness. More testing sure could be done.
Signed-off-by: Art McGee <amcgee7@jaguarlandrover.com>
Adds the ExtractDateTime parse function from Christopher. When imported from mycroft/util/parse.py, it'll take a sentence like "What's the weather like 5 weeks from next Wednesday?" and will extract a python datetime object for that date.
* Added requirements.txt change for importing dateutil