diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b8e2a50e26..4c2013d9e1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -22,7 +22,7 @@ The following guidelines for contribution should be followed if you want to subm
5. Make use of the `.editorconfig`-file if provided with the repository.
6. Make commits of logical units and describe them properly. Use your issue identifier at the very begin of each commit. For instance:
`git commit -m "Issues-123 - Fixing 'A' sound on Spelling Skill"`
- 7. Before committing, format your code following the PEP8 rules and organize your imports removing unused libs.
+ 7. Before committing, format your code following the PEP8 rules and organize your imports removing unused libs. To check whether you are following these rules, install pep8 and run `pep8 mycroft test` while in the `mycroft-core` folder. This will check for formatting issues in the `mycroft` and `test` folders.
8. Once you have committed everything and are done with your branch, you have to rebase your code with master. Do the following steps:
1. Make sure you do not have any changes left on your branch
2. Checkout on master branch and make sure it is up-to-date
@@ -39,10 +39,10 @@ git rebase master
git push -f
```
9. If possible, create unit tests for your changes
- * [Unit Tests for most contributions](https://github.com/MycroftAI/mycroft/tree/master/test)
- * [Intent Tests for new skills](https://github.com/MycroftAI/mycroft/tree/master/mycroft/skills/weather)
+ * [Unit Tests for most contributions](https://github.com/MycroftAI/mycroft-core/tree/master/test)
+ * [Intent Tests for new skills](https://docs.mycroft.ai/development/creating-a-skill#testing-your-skill)
* We utilize TRAVIS-CI, which will test each pull request. To test locally you can run: `./start.sh unittest`
- 10. Once everything is OK, you can finally create a Pull Request (PR) on Github in order to be reviewed and merged (to provide GH wiki page link)
+ 10. Once everything is OK, you can finally [create a Pull Request (PR) on Github](https://help.github.com/articles/using-pull-requests/) in order to be reviewed and merged.
**Note**: Even if you have write access to the master branch, do not work directly on master!
diff --git a/dev_setup.sh b/dev_setup.sh
index b6e6e0ffef..a4fcf3df8f 100755
--- a/dev_setup.sh
+++ b/dev_setup.sh
@@ -37,15 +37,15 @@ VIRTUALENV_ROOT=${VIRTUALENV_ROOT:-"${HOME}/.virtualenvs/mycroft"}
# create virtualenv, consistent with virtualenv-wrapper conventions
if [ ! -d ${VIRTUALENV_ROOT} ]; then
- mkdir -p $(dirname ${VIRTUALENV_ROOT})
- virtualenv ${VIRTUALENV_ROOT}
+ mkdir -p $(dirname ${VIRTUALENV_ROOT})
+ virtualenv -p python2.7 ${VIRTUALENV_ROOT}
fi
source ${VIRTUALENV_ROOT}/bin/activate
cd ${TOP}
easy_install pip==7.1.2 # force version of pip
# install requirements (except pocketsphinx)
-pip install -r requirements.txt --trusted-host pypi.mycroft.team
+pip install -r requirements.txt
# clone pocketsphinx-python at HEAD (fix to a constant version later)
if [ ! -d ${TOP}/pocketsphinx-python ]; then
diff --git a/mycroft/skills/cerberus_config/test/intent/sample1.intent.json b/mycroft/skills/cerberus_config/test/intent/sample1.intent.json
new file mode 100644
index 0000000000..6b21b6667b
--- /dev/null
+++ b/mycroft/skills/cerberus_config/test/intent/sample1.intent.json
@@ -0,0 +1,7 @@
+{
+ "utterance": "update configuration",
+ "intent_type": "UpdateConfigurationIntent",
+ "intent": {
+ "UpdateConfigurationPhrase": "update configuration"
+ }
+}
diff --git a/mycroft/skills/pairing/test/intent/sample1.intent.json b/mycroft/skills/pairing/test/intent/sample1.intent.json
new file mode 100644
index 0000000000..261bbc589b
--- /dev/null
+++ b/mycroft/skills/pairing/test/intent/sample1.intent.json
@@ -0,0 +1,7 @@
+{
+ "utterance": "let's pair my device",
+ "intent_type": "PairingIntent",
+ "intent": {
+ "DevicePairingPhrase": "pair my device"
+ }
+}
diff --git a/mycroft/skills/pairing/test/intent/sample2.intent.json b/mycroft/skills/pairing/test/intent/sample2.intent.json
new file mode 100644
index 0000000000..b5a167b33c
--- /dev/null
+++ b/mycroft/skills/pairing/test/intent/sample2.intent.json
@@ -0,0 +1,7 @@
+{
+ "utterance": "register my device",
+ "intent_type": "PairingIntent",
+ "intent": {
+ "DevicePairingPhrase": "register my device"
+ }
+}
diff --git a/mycroft/skills/stop/test/intent/sample1.intent.json b/mycroft/skills/stop/test/intent/sample1.intent.json
new file mode 100644
index 0000000000..361d80c4f4
--- /dev/null
+++ b/mycroft/skills/stop/test/intent/sample1.intent.json
@@ -0,0 +1,7 @@
+{
+ "utterance": "would you shut up",
+ "intent_type": "StopIntent",
+ "intent": {
+ "StopKeyword": "shut up"
+ }
+}
diff --git a/mycroft/skills/stop/test/intent/sample2.intent.json b/mycroft/skills/stop/test/intent/sample2.intent.json
new file mode 100644
index 0000000000..95bb0043e4
--- /dev/null
+++ b/mycroft/skills/stop/test/intent/sample2.intent.json
@@ -0,0 +1,7 @@
+{
+ "utterance": "stop",
+ "intent_type": "StopIntent",
+ "intent": {
+ "StopKeyword": "stop"
+ }
+}
diff --git a/mycroft/skills/wolfram_alpha/__init__.py b/mycroft/skills/wolfram_alpha/__init__.py
index 911064a203..750bca31fa 100644
--- a/mycroft/skills/wolfram_alpha/__init__.py
+++ b/mycroft/skills/wolfram_alpha/__init__.py
@@ -87,7 +87,7 @@ class CerberusWolframAlphaClient(object):
response = requests.get(url, headers=headers)
if response.status_code == 401:
raise CerberusAccessDenied()
-
+ logger.debug(response.content)
return wolframalpha.Result(StringIO(response.content))
@@ -108,6 +108,28 @@ class WolframAlphaSkill(MycroftSkill):
self.init_dialog(dirname(__file__))
self.emitter.on('intent_failure', self.handle_fallback)
+ def get_result(self, res):
+ result = None
+ try:
+ result = next(res.results).text
+ return result
+ except:
+ try:
+ result = self.__find_value(res.pods, 'Value')
+ if not result:
+ result = self.__find_value(
+ res.pods, 'NotableFacts:PeopleData')
+ if not result:
+ result = self.__find_value(
+ res.pods, 'BasicInformation:PeopleData')
+ if not result:
+ result = self.__find_value(
+ res.pods, 'DecimalApproximation')
+ result = result[:5]
+ return result
+ except:
+ return result
+
def handle_fallback(self, message):
logger.debug(
"Could not determine intent, falling back to WolframAlpha Skill!")
@@ -127,6 +149,7 @@ class WolframAlphaSkill(MycroftSkill):
try:
res = self.client.query(query)
+ result = self.get_result(res)
except CerberusAccessDenied as e:
self.speak_dialog('not.paired')
return
@@ -135,20 +158,6 @@ class WolframAlphaSkill(MycroftSkill):
self.speak("Sorry, I don't understand your request.")
return
- result = None
- try:
- result = next(res.results).text
- except:
- try:
- result = self.__find_value(res.pods, 'Value')
-
- if not result:
- result = self.__find_value(
- res.pods, 'DecimalApproximation')
- result = result[:5]
- except:
- pass
-
if result:
input_interpretation = self.__find_value(res.pods, 'Input')
verb = "is"
diff --git a/requirements.txt b/requirements.txt
index 9c7c83c44a..a100ef6ca7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,7 +14,7 @@ pyee==1.0.1
SpeechRecognition==3.1.3
tornado==4.2.1
websocket-client==0.32.0
-adapt-parser==0.2.1
+adapt-parser==0.2.3
pyowm==2.2.1
wolframalpha==1.4
futures==3.0.3
@@ -32,4 +32,3 @@ netifaces==0.10.4
pyjokes==0.5.0
psutil==4.1.0
pep8==1.7.0
---extra-index-url=http://pypi.mycroft.team
diff --git a/skills-sdk-setup.py b/skills-sdk-setup.py
index a244ad4f92..e81ea7d927 100644
--- a/skills-sdk-setup.py
+++ b/skills-sdk-setup.py
@@ -1,4 +1,5 @@
from setuptools import setup
+
from mycroft.util.setup_base import get_version, place_manifest
__author__ = 'seanfitz'
@@ -17,7 +18,6 @@ setup(
],
packages=[
"mycroft.configuration",
- "mycroft.configuration.defaults",
"mycroft.dialog",
"mycroft.filesystem",
"mycroft.messagebus",
diff --git a/test/skills/wolfram_alpha/__init__.py b/test/skills/wolfram_alpha/__init__.py
new file mode 100644
index 0000000000..2f04bd85d2
--- /dev/null
+++ b/test/skills/wolfram_alpha/__init__.py
@@ -0,0 +1,50 @@
+import unittest
+import wolframalpha
+from StringIO import StringIO
+
+from mycroft.skills.wolfram_alpha import WolframAlphaSkill
+from mycroft.util.log import getLogger
+
+__author__ = 'eward'
+
+logger = getLogger(__name__)
+
+# necessary amount of text for testing: "\
+# \
+# Test"
+
+
+class WolframAlphaTest(unittest.TestCase):
+ def format_result(self, pod_id, text):
+ return "\
+ \
+ " + text + ""
+
+ def create_result(self, pod_id, value):
+ result = self.format_result(pod_id, value)
+ return wolframalpha.Result(StringIO(result))
+
+ def test_result_pod(self):
+ res = self.create_result("Result", "7")
+ self.assertEquals(WolframAlphaSkill().get_result(res), "7")
+
+ def test_value_pod(self):
+ res = self.create_result("Value", "2^3")
+ self.assertEquals(WolframAlphaSkill().get_result(res), "2^3")
+
+ def test_notable_facts_pod(self):
+ res = self.create_result("NotableFacts:PeopleData", "PeopleData")
+ self.assertEquals(WolframAlphaSkill().get_result(res), "PeopleData")
+
+ def test_basic_information_pod(self):
+ res = self.create_result("BasicInformation:PeopleData",
+ "Born in 1997")
+ self.assertEquals(WolframAlphaSkill().get_result(res), "Born in 1997")
+
+ def test_decimal_approximation_pod(self):
+ res = self.create_result("DecimalApproximation", "5.6666666666")
+ self.assertEquals(WolframAlphaSkill().get_result(res), "5.666")
+
+ def test_invalid_pod(self):
+ res = self.create_result("InvalidTitle", "Test")
+ self.assertEquals(WolframAlphaSkill().get_result(res), None)