import os logDirectory = r"./BuildLogs" pdfDirectory = r"./Documents" pdfFiles = os.listdir(pdfDirectory) expectedDocuments = ["DAM - Architecture Overall.pdf", "DAM - Projectplan.pdf"] print ("##teamcity[testStarted name='PDF Generated']") for doc in expectedDocuments: if doc not in pdfFiles: print ("##teamcity[testFailed name='PDF Generated' message='{} - Not Generated']".format(doc.strip())) print ("##teamcity[testFinished name='PDF Generated']") logFiles = os.listdir(logDirectory) for log in logFiles: name = log.strip("_Log.txt") path = os.path.join(logDirectory,log) print ("##teamcity[testSuiteStarted name='{}']".format(name)) fi = open(path, 'r') logLines = fi.readlines() print ("##teamcity[testStarted name='LaTeX Warnings']") for line in logLines: text = line.replace("'", " ") text = text.replace("`", " ") if "LaTeX Warning:" in line: if "was:used:in:doc" not in text and "\@arrayparboxrestore" not in text and "There were multiply-defined labels" not in text and "underbar has changed" not in text and "underline has changed" not in text and 'Font shape declaration has incorrect series value' not in text and 'You have requested document class ../WTI_References/BOIReleaseN' not in text: print("##teamcity[testFailed name='LaTeX Warnings' message='{}']".format(text.strip())) print ("##teamcity[testFinished name='LaTeX Warnings']") print ("##teamcity[testStarted name='Citation Warnings']") for line in logLines: text = line.replace("'", " ") text = text.replace("`", " ") if "Package natbib Warning: Citation" in line: print ("##teamcity[testFailed name='Citation Warnings' message='{}']".format(text.strip())) print ("##teamcity[testFinished name='Citation Warnings']") print ("##teamcity[testSuiteFinished name='{}']".format(name)) fi.close()