示例#1
0
    def test_mspeechsong(self):
        """   pudding speech song test
        """
        time.sleep(5)
        strdata, strresult = MyUtil.Getspeechcase(u'唱首歌')
        result = speech.sendspeech(strdata, strresult, "song", 40)
        if (result == 0):
            print "Pudding speech song  successful"
        else:
            print "Pudding speech song failure"

            self.fail("Pudding speech song FAILURE")
示例#2
0
    def test_kspeechsilent(self):
        """   pudding speech silent test
        """
        failcount = 0
        for i in range(3):
            time.sleep(5)
            strdata, strresult = MyUtil.Getspeechcase(u'静音')
            result = speech.sendspeech(strdata, strresult, "silent", 40)
            if (result == 0):
                print "Pudding speech silent  successful"
            else:
                print "Pudding speech silent  failure"
                failcount += 1

        if failcount >= 1:
            self.fail("Pudding silent  FAILURE")
示例#3
0
    def test_lspeechschedule(self):
        """   pudding speech schedule test
        """
        failcount = 0
        for i in range(3):
            time.sleep(5)
            strdata, strresult = MyUtil.Getspeechcase(u'一小时后提醒我测试')
            result = speech.sendspeech(strdata, strresult, "schedule", 40)
            if (result == 0):
                print "Pudding speech schedule  successful"
            else:
                print "Pudding speech schedule  failure"
                failcount += 1

        if failcount >= 1:
            self.fail("Pudding schedule  FAILURE")
示例#4
0
    def test_jspeechsign(self):
        """   pudding speech sign test
        """
        failcount = 0
        for i in range(3):
            time.sleep(5)
            strdata, strresult = MyUtil.Getspeechcase(u'摩羯座星座运势')
            result = speech.sendspeech(strdata, strresult, "sign", 120)
            if (result == 0):
                print "Pudding speech sign  successful"
            else:
                print "Pudding speech sign  failure"
                failcount += 1

        if failcount >= 1:
            self.fail("Pudding sign  FAILURE")
示例#5
0
    def test_ispeechpm(self):
        """   pudding speech pm test
        """
        failcount = 0
        for i in range(3):
            time.sleep(5)
            strdata, strresult = MyUtil.Getspeechcase(u'空气质量')
            result = speech.sendspeech(strdata, strresult, "pm", 40)
            if (result == 0):
                print "Pudding speech pm  successful"
            else:
                print "Pudding speech pm  failure"
                failcount += 1

        if failcount >= 1:
            self.fail("Pudding pm  FAILURE")
示例#6
0
    def test_hspeechweather(self):
        """   pudding speech weather test
        """
        failcount = 0
        for i in range(3):
            time.sleep(5)
            strdata, strresult = MyUtil.Getspeechcase(u'天气预报')
            result = speech.sendspeech(strdata, strresult, "weather", 40)
            if (result == 0):
                print "Pudding speech weather  successful"
            else:
                print "Pudding speech weather  failure"
                failcount += 1

        if failcount >= 1:
            self.fail("Pudding weather  FAILURE")
示例#7
0
    def test_gspeechwhen(self):
        """   pudding speech when test
        """
        failcount = 0
        for i in range(3):
            time.sleep(5)
            strdata, strresult = MyUtil.Getspeechcase(u'现在几点了')
            result = speech.sendspeech(strdata, strresult, "when", 40)
            if (result == 0):
                print "Pudding speech when  successful"
            else:
                print "Pudding speech when  failure"
                failcount += 1

        if failcount >= 1:
            self.fail("Pudding when  FAILURE")
示例#8
0
    def test_fspeechupvolume(self):
        """   pudding speech upvolume test
        """
        failcount = 0
        for i in range(3):
            time.sleep(5)
            strdata, strresult = MyUtil.Getspeechcase(u'大点声')
            result = speech.sendspeech(strdata, strresult, "upvolume", 40)
            if (result == 0):
                print "Pudding speech upvolume  successful"
            else:
                print "Pudding speech upvolume  failure"
                failcount += 1

        if failcount >= 1:
            self.fail("Pudding upvolume  FAILURE")
示例#9
0
文件: speech.py 项目: rfhy/py
import json
import os
import sys
import string
import time
import md5
import hashlib
import MyUtil
import sqlite3
import datetime
import autoresult
reload(sys)
sys.setdefaultencoding('utf-8')
sn = MyUtil.Getsn()
pcmpath = MyUtil.Getfile("pcm")
sleepjson, sleepresult = MyUtil.Getspeechcase(u"再见")
alllogcatlist = []


def killlogcat():
    pidlogcat = "adb -s " + sn + " shell \" ps | grep ' logcat' | busybox awk '{print $2}' \""
    test = os.popen(pidlogcat)
    time.sleep(3)
    text = test.read()
    ##    print text
    test.close()
    testlist = text.replace("\n", " ").replace("\r", " ").split(" ")
    for l in testlist:
        if l == '' or l == ' ':
            continue
        else: