コード例 #1
0
ファイル: test_runCommand.py プロジェクト: zrzhd/qtsdk
 def test_withThreadedWork(self):
     currentMethodName = sys._getframe().f_code.co_name
     testWork = ThreadedWork("{} - run some command threaded".format(currentMethodName))
     taskStringList = []
     taskStringList.append("--sleep 1 --printLines 10")
     taskStringList.append("--sleep 2 --printLines 30")
     taskStringList.append("--sleep 1 --printLines 40")
     taskStringList.append("--sleep 2 --printLines 50")
     taskStringList.append("--sleep 1 --printLines 100")
     for taskString in taskStringList:
         testWork.addTask(taskString, useRunCommand, taskString, os.getcwd())
     testWork.run()
コード例 #2
0
ファイル: test_runCommand.py プロジェクト: zrzhd/qtsdk
 def test_withThreadedWork_crash(self):
     currentMethodName = sys._getframe().f_code.co_name
     testWork = ThreadedWork("{} - run some command threaded".format(currentMethodName))
     # this exchange the current os._exit(-1) implementation only for this testing case
     separatorLine = "{0}>>>>>>>>>>>>>>>>>>>>>>>>>>>>>{0}".format(os.linesep)
     separatorText = "the complete python application would stop here"
     testWork.setExitFailFunction(sys.__stdout__.write, ''.join([separatorLine, separatorText, separatorLine]))
     taskStringList = []
     taskStringList.append("--sleep 1 --printLines 10")
     taskStringList.append("--sleep 2 --printLines 30")
     taskStringList.append("--sleep 1 --printLines 40")
     taskStringList.append("--sleep 2 --printLines 3 --crash")
     taskStringList.append("--sleep 1 --printLines 100")
     for taskString in taskStringList:
         testWork.addTask(taskString, useRunCommand, taskString, os.getcwd())
     testWork.run()