From 6d4a3fb3358c7f0f20ffa2ce859c4f54e1ef0be3 Mon Sep 17 00:00:00 2001 From: schneefux Date: Tue, 9 Sep 2014 08:11:51 +0100 Subject: Added travis --- .travis.yml | 9 +++++++++ client/test.py | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..95079e7 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: python + +env: + - ARCH=x86 + +script: + - "pip install -r client/requirements.txt" + - "cd client && python test.py --light" + - "cd ../boot && python test.py" diff --git a/client/test.py b/client/test.py index 29b9ce0..7797058 100644 --- a/client/test.py +++ b/client/test.py @@ -1,4 +1,5 @@ import os +import sys if os.environ.get('JASPER_HOME') is None: os.environ['JASPER_HOME'] = '/home/pi' @@ -12,6 +13,11 @@ import test_mic import g2p import brain +DEFAULT_PROFILE = { + 'prefers_email': False, + 'location': 'travis', + 'phone_number': '012344321' + } def activeInternet(): try: @@ -65,7 +71,7 @@ class TestG2P(unittest.TestCase): class TestModules(unittest.TestCase): def setUp(self): - self.profile = yaml.safe_load(open("profile.yml", "r")) + self.profile = DEFAULT_PROFILE self.send = False def runConversation(self, query, inputs, module): @@ -162,7 +168,7 @@ class TestBrain(unittest.TestCase): @staticmethod def _emptyBrain(): mic = test_mic.Mic([]) - profile = yaml.safe_load(open("profile.yml", "r")) + profile = DEFAULT_PROFILE return brain.Brain(mic, profile) @patch.object(brain, 'logError') @@ -210,4 +216,7 @@ if __name__ == '__main__': for test_case in test_cases: suite.addTests(unittest.TestLoader().loadTestsFromTestCase(test_case)) - unittest.TextTestRunner(verbosity=2).run(suite) + result = unittest.TextTestRunner(verbosity=2).run(suite) + + if not result.wasSuccessful(): + sys.exit("Tests failed") -- cgit v1.3.1