Add basic unittest for espeak

pull/2581/head
Åke Forslund 2020-05-11 15:52:30 +02:00
parent 23c04bf9f0
commit 4d065ff7fe
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
import unittest
from unittest import mock
from mycroft.tts.espeak_tts import ESpeak
@mock.patch('mycroft.tts.tts.PlaybackThread')
class TestMimic(unittest.TestCase):
@mock.patch('mycroft.tts.espeak_tts.subprocess')
def test_get_tts(self, mock_subprocess, _):
conf = {
"lang": "english-us",
"voice": "m1"
}
e = ESpeak('en-US', conf)
sentence = 'hello'
wav_filename = 'abc.wav'
wav, phonemes = e.get_tts(sentence, wav_filename)
self.assertTrue(phonemes is None)
mock_subprocess.call.called_with(['espeak', '-v',
conf['lang'] + '+' + conf['voice'],
'-w', wav_filename,
sentence])