Commit Graph

281 Commits (979c02158d95ad3cbdd17a14c0f3d6f415ae58fa)

Author SHA1 Message Date
Åke 129b9456e9
Merge pull request #1770 from MycroftAI/feature/python3isms
Address Python 3 changes
2018-08-28 20:56:41 +02:00
Steve Penrod 97138ae403 Address Python 3 changes 2018-08-28 12:41:59 -05:00
Åke 787ff63d2b Remove trailing references to MycroftSkill.emitter (#1768)
- references in skill_tester.py
- when going through the methods to check for decorations the emitter
was triggered and generated a Warning
2018-08-28 12:26:46 -05:00
Steve Penrod e1ab1c2a47 Merge branch 'feature/simple-audio' of git://github.com/forslund/mycroft-core into forslund-feature/simple-audio
# Conflicts:
#	mycroft/audio/services/simple/__init__.py
2018-08-27 14:32:45 -05:00
Åke Forslund dd786186f6 Update test cases for the new resource loading 2018-08-27 13:42:46 +02:00
Åke Forslund a180672db5 Minor update to service loading testcase 2018-08-23 09:50:30 +02:00
Åke 4aac668a2f Remove depreciated ScheduledSkill (#1731)
- remove the scheduled_skills module
- remove the time_rules module
- remove parsedatetime requirement (only used in scheduled_skills)
2018-08-21 20:53:52 -05:00
Åke 3d18df3d6d Add support for separate settings for test (#1753)
The json can now include a "settings" entry which will replace the skill's self.settings for that particular test.
2018-08-21 20:50:06 -05:00
Åke bc0dec4719
Merge pull request #1756 from MycroftAI/feature/remove-extractnumber
Remove deprecated extractnumber
2018-08-21 21:28:47 +02:00
Matthew D. Scholefield c138fda79e
Merge pull request #1725 from forslund/feature/__main__
Feature/__main__
2018-08-21 10:29:13 -05:00
Åke Forslund b7e1cb835c Fix broken test
- update test_parse*
- correct the reference in mycroft.util
2018-08-21 11:57:12 +02:00
Steve Penrod 6dc46e8c0c Enhance tester output
Several visual changes to the logs (no functional difference)
* Added 'with' to close test_case_file, quieting warning
* Highlight Mycroft's utterannces in output and moved print to fix order of printing
* Better highlight sending a response
* Highlight the test utterance
2018-08-21 04:03:03 -05:00
Åke Forslund 6fa17dbed3 Separate AudioService from main 2018-08-16 20:45:17 +02:00
Åke Forslund a66e23d8ab start processess using python -m
- rename process main.py to __main__.py
- update start-mycroft.sh/stop-mycroft.sh scripts to reflect the change
2018-08-16 15:21:22 +02:00
Åke 3986d1fbb0 Handle remove_all_listeners (#1742)
Allow the test mocked emitter to handle emitter.remove_all_listeners
2018-08-15 03:32:12 -05:00
Michael Nguyen 35134ddaeb fix unit tests for 4 digit number 2018-08-15 00:44:22 -05:00
Michael Nguyen 7b54149bcd
Merge pull request #1653 from JarbasAl/feature/pronounce_scientific
Feature/pronounce scientific
2018-07-31 13:04:14 -05:00
Steve Penrod ec73b7d48e
Fix named event scheduling/deleting (#1705)
While working on the Alarm skill I discovered several issues with the
event scheduler.  This PR cleans up those findings and resolves several
other potential issues:

1) To avoid thread synchronization issues, the EventScheduler had several
queues which independently held objects to be added/deleted/updated.  However, the order of the events was undefined and got mixed since they were all batched together.  So, for instance, if skill code performed:
   self.add_event("foo", self.handle_foo)
   if SomeReason:
       self.cancel_event("foo")
The actual order of queue handling would perform Remove first, then Add which resulted in "foo" not being found for delete, but then added and left as an active event.

Now the EventScheduler protects the list using a Lock and the queues have been removed.  Modifications to the list happen immediately after obtaining the lock and are not batched up.

2) One-time events were triggered while the event was still in the EventScheduler list.  Now the entry is removed before invoking the handler.

3) Within the MycroftSkill.add_event(name, handler) is a local 'wrapper' method that actually makes the callback.  The MycroftSkill.remove_event(name) method attempted to find entries in the events list and the associated handler entries in the self.emitter to remove.  However, the emitter actually held the wrapper(handler), not the handler itself.  So the emitter handlers were left behind.

This was a quiet bug until the next time you scheduled an event of the same name.  When that second event finally triggered, it would fire off both the new and the old handler -- which snowballed in the 'skill-alarm:Beep' case, doubling and redoubling with every beep.

Now this cancels all the emitter listeners by name.  There is a very slim chance that someone has registered a listener with the same name, but since it is namespaced to "skill-name:Event" I think this is pretty safe.


Not technically related, but a failure that has been lurking for
some time and is a French unit test that doesn't work depending
on the time of day when the test is run.
2018-07-30 15:08:13 -05:00
Josh Cox 2abb8fa74b Add Ogg123 support (#1678)
This is reimplementation of #1649 which became divergent.

## Description
Adds a Ogg123Service and a play_ogg exactly like Mpg123Service and play_mp3

## How to test
I have a skill for a podcast which does not have an mp3 feed:
https://github.com/joshuacox/skill-GNUworldOrder

## Contributor license agreement signed?
signed by @joshuacox
2018-07-26 22:25:39 -05:00
f-e-l-i-x 9e2dc9628e German formatting for Wolfram alpha skill responses in format_de.py (#1669)
Response formatting for German language ordinals depending on cases/prepositions for dates
"am 1. März" -> "am ersten März" (on the first of March)
"der 1. März" -> "der erste März" (the first of March)
"1. März" -> "erster März" (first of March)

Response formatting for mathematical results
"10 ^ 2" -> "10 hoch 2" (ten to the power of two)

Can be tested via the corresponding test_format_de or by using wolfram alpha skill:
"Was ist die Fläche von Canada"
"Wann ist George Washington geboren"
2018-07-19 02:44:33 -05:00
Steve Penrod dd807b2b2e
Improve the standalone skill tester (#1683)
* Improve the standalone skill tester

Using the skill tester was difficult -- the skill author had to copy a file
locally, and figuring out what was wrong with a test wasn't obvious.  This
change improves it in several ways:
* The tester can now be run as a module, allowing any skill to be tested
  by entering the skill folder and running:
  ```
  python -m test.integrationtests.skills.runner
  ```
  Optionally you can pass along a path to the skill.
* The runner will display help with a '--help' parameter, pointing to
  documentation on creating the tests.
* Information on where the tests are expected is printed during execution
* The *.intent.json was reduced to simply *.json since this is under an
  ```test/intent/``` folder already.  (This is backwards compatible for
  existing intent tests.)
* The failing rule is now displayed at the bottom of the run report, making
  it easier to figure out where issues exist during test creation
* Headers and terminal colors are used in the output, making it easier to
  visually parse the output from the execution of tests.

====  Documentation Notes ====
Update the skill documentation to reflect using
  python -m test.integrationtests.skills.runner
instead of copying the skill_developers_testrunner.py.

NOTE: This does have to be performed within a developer venv in order to
access the test suite.  Consider moving this into a mycroft-core-dev package
in the future for Mark 1 / Picroft users.

* Quieting warning from Codacy

* Replace single_test with runner

Adds support for "test_env" to the runner script

* Update the discover_test to match the runner

- catch intent tests from *.json files
- add failure msg to assert

* Turn off color using MST_NO_COLOR env variable
2018-07-19 02:23:22 -05:00
Åke Forslund b4b78fa43a correct testcases 2018-07-18 13:46:27 +02:00
Steve Penrod 3624680698 Enhance extract_datetime(), add time utilities
Many cases that were missed in the unittests for extract_datetime()
from the original source.  Restored those tests and made code
adjustments to support them all.

Also adding the mycroft.util.time module.  This supports:
* mycroft.util.time.default_timezone()
  Returns the user-configured timezone based on location
* mycroft.util.time.now_utc()
  Returns the time in UTC
* mycroft.util.time.now_local()
  Returns the time in the user's timezone
* mycroft.util.time.to_utc()
  Converts to UTC
* mycroft.util.time.to_local()
  Converts to user's timezone

NOTE: Several skills should be updated to use these now.

==== Fixed Issues ====
Several issues for skills regarding parsing of "today"

====  Documentation Notes ====
Note the new module:  mycroft.util.time

==== Localization Notes ====
Localized versions of extract_datetime() likely need to be
updated, as most were based on the original English implementation
2018-07-18 13:46:27 +02:00
JarbasAI 6cf2ed814c feature/allow to pronounce ordinals and very small fractions (#1663)
* allow to pronounce ordinals

* cleanup

* long scale / short scale very small fractions
2018-07-10 02:54:04 -05:00
Åke 1093383443 Fix extraction of 0 in extract_number() (#1673)
0 was not detected as a valid number when checking if the function should proceed to check for fractions.
2018-07-10 02:26:25 -05:00
Åke 622748d7d3 Bugfix/parse corrections (#1670)
* Restore extractdatetime to return False

- Restore extractdatetime to return False if no time was found
- Add tests to make sure this is true
- Add a extract_datetime function to keep coherency with the rest of the functions. (the old extractdatetime still exists for compatibility)
- Update documentation to match

* Minor corrections to docstrings.
2018-07-02 02:44:28 -05:00
JarbasAI fa4173a2d3 fix extract date (#1651)
* Fix errors when spaces are missing "3pm" "5seconds"
* Fix relative times "in 15 minutes" is now from current time not from midnight

Resolves #1650
2018-06-26 11:45:39 +02:00
Carsten Agerskov 5994644085 Feature/nice date (#1635)
* Added nice_date, nice_date_time, nice_year
2018-06-25 17:43:24 +02:00
Åke b1408617bc CLI Feature: skill commands (#1612)
* Update format for skill listing

Now send the skills with id and active status

* Add commands to activate/deactivate skills

* Add "unload all except one" functionallity

* Update after rebasing

- fix identifying skills

* Unload skills if they're removed from disk

* Rename _shutdown to default_shutdown

The method is not intended to be non-public, and this should shut up
codacy bot.

* Handle keep command without argument

* Add new commands to help

- Split help into multiple pages as needed

* Support :activate all
2018-06-22 00:59:51 -05:00
jarbasal 57a86a7fe6 pep8 2018-06-22 01:03:32 +01:00
jarbasal 1710803bb0 pronounce scientific notation 2018-06-22 01:03:32 +01:00
jarbasal 2f05b0b820 fix extra zero 2018-06-22 01:01:59 +01:00
jarbasal 5c424fecc1 long scale 2018-06-19 02:18:27 +01:00
jarbasal f83b4f97bb pronounce big numbers 2018-06-19 02:18:27 +01:00
jarbasal 7e1fb80cb4 improve extract_number_en
- Support higher numbers, almost unreasonably high!
- Support long scale and short scale
2018-06-18 15:45:14 +02:00
Matthew D. Scholefield c7d8413b7c
Merge pull request #1630 from forslund/test/base-config
Make use of the default config when testing.
2018-06-14 14:53:37 -05:00
f-e-l-i-x b239d3dc2f German language support (#1634)
* Add parse and format functions for german
* Add german dialog files
2018-06-12 08:55:21 +02:00
Åke Forslund 451a43fe51 Make use of the default config when testing.
Always use the default config as base config to make tests less error prone when changes occur.
2018-06-07 19:57:09 +02:00
Åke Forslund 9bc97677b2 Update test configuration for listerner 2018-06-06 22:37:34 +02:00
Åke Forslund 4ec255493b Add intent_type checks for padatious 2018-06-01 15:05:10 +02:00
Åke Forslund b8b60abff0 Improve 'or' logic
'or' would fail trying to parse 'succeeded'
2018-06-01 15:04:49 +02:00
Matthew D. Scholefield a5b3b6f9e4 Add support for SKILL_DIR variable to execute just one skill test 2018-05-31 19:18:15 -05:00
Matthew D. Scholefield cc582ce38c Fix starting skillstest via start-mycroft.sh
This also removes the ability to pass the skills dir as the first argument. Instead this was moved to an environment variable called SKILLS_DIR to prevent conflict with pytest arguments
2018-05-31 19:17:26 -05:00
Åke Forslund d25b679bd9 Don't force types for expected_data
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
2018-05-29 16:54:04 +02:00
Åke Forslund e7a6a20967 Sort test cases so order is enforced 2018-05-28 15:32:56 +02:00
Åke Forslund d99377dc78 Fix discover_test get_skills_dir()
The discover_test didn't handle configurable data path correctly.
2018-05-28 09:10:35 +02:00
Matthew D. Scholefield b0b88bbd62 Remove all references to /opt/mycroft 2018-05-23 08:22:14 +02:00
Matthew D. Scholefield 14ceb1f1dd Remove all references to /opt/mycroft/skills
The only thing that should reference it is the config
2018-05-23 08:22:14 +02:00
Åke 95525205ec
Fix bad city information in test (#1607) 2018-05-23 08:21:10 +02:00
CarstenAgerskov a353c43748 Fixes for Python3 migration 2018-05-21 18:45:47 -05:00