def main(): global report_file, runner, fp, Report_title # tolist=cfgValue.mailToList # tolist = mailToList = ["*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**"] report = "report" report_file = TestReport.generate_report(report) runner = tr() fp = file(report_file, 'wb') report_title = report + DASH + test_suite.__name__ runner = tr(stream=fp, title=report_title, description=report_file) runner.run(test_suite()) fp.close()
def main(): global report_file, runner, fp, Report_title # tolist=cfgValue.mailToList # tolist = mailToList = ["*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**"] #dbOperation().BackupDB("%s/backup.sql" % os.path.dirname(os.path.abspath(__file__))) reportTitle = "Report"#cfgValue.M4Report report_file = TestReport.generate_report(reportTitle) #print 'report_file: ',report_file runner = tr() fp = file(report_file, 'wb') Report_title = reportTitle + DASH + testsuite.__name__ runner = tr(stream=fp, title=Report_title, description=report_file) runner.run(testsuite()) fp.close()
) # вычитываем исходный .t файл и помещаем всё содержимое во входящий поток к тестируемой программе # if "input" in testConfiguration: # copy2(myDir + file, str(testConfiguration["input"])) # inputDataForUsersProgram = open(str(testConfiguration["input"]), "rb").read() # else: # inputDataForUsersProgram = open(myDir + file, "rb").read() # proc.stdin.write(inputDataForUsersProgram) # ждем отклика в течение таймаута, в outs - результат работы программы try: outs, errs = proc.communicate(timeout=maxExecutionTimeDelay) except subprocess.TimeoutExpired: proc.kill() outs, errs = proc.communicate() retArray.append(TestReport(TestReport.OTHER, Locale.Timeout)) break finally: if "input" in testConfiguration and os.path.exists( str(testConfiguration["input"])): os.remove(str(testConfiguration["input"])) # надо проверить .a файлы с ответами correctAnswers = getCorrectAnswers(dirWithTests, file) # функция проверки правильного ответа - пока единственный обязательный параметр конфига funcToCheckAnswer = testConfiguration.get("func", None) if funcToCheckAnswer is None: break # кодировочный костыль, иногда приходит в кодировке анси