def getTitle(self): title = "Tests: " if self.testSuiteSelection: # We don't care about totals with test suites title += plugins.pluralise(self.nofSelectedTests, "suite") + " selected" if self.nofDistinctSelectedTests != self.nofSelectedTests: title += ", " + str(self.nofDistinctSelectedTests) + " distinct" return title if self.nofSelectedTests == self.totalNofTests: title += "All " + str(self.totalNofTests) + " selected" else: title += str(self.nofSelectedTests) + "/" + str(self.totalNofTests) + " selected" if not self.dynamic: if self.totalNofDistinctTests != self.totalNofTests: if self.nofDistinctSelectedTests == self.totalNofDistinctTests: title += ", all " + str(self.totalNofDistinctTests) + " distinct" else: title += ", " + str(self.nofDistinctSelectedTests) + "/" + str(self.totalNofDistinctTests) + " distinct" if self.totalNofTestsShown == self.totalNofTests: if self.dynamic and self.totalNofTests > 0: title += ", none hidden" elif self.totalNofTestsShown == 0: title += ", all hidden" else: title += ", " + str(self.totalNofTests - self.totalNofTestsShown) + " hidden" return title
def computeFor(self, test, ignoreMissing=False): self.makeComparisons(test, ignoreMissing) self.categorise() rerunCount = self.getRerunCount(test) if rerunCount and self.hasSucceeded(): self.briefText = "after " + plugins.pluralise(rerunCount, "rerun") test.changeState(self)
def getTimeDescription(seconds): values = list(time.gmtime(seconds)[2:6]) values[0] -= 1 # not actually using timedelta which doesn't support formatting... units = [ "day", "hour", "minute", "second" ] parts = [] for unit, val in zip(units, values): if val: parts.append(plugins.pluralise(val, unit)) if len(parts) > 0: description = " and ".join(parts).replace(" and ", ", ", len(parts) - 2) else: description = "Less than 1 second" return description
def describePerformance(fileName): line = open(fileName).readline().strip() if "mem" in os.path.basename(fileName): return line # Assume seconds perf = getPerformanceFromLine(line) values = list(time.gmtime(perf)[2:6]) values[0] -= 1 # not actually using timedelta which doesn't support formatting... units = [ "day", "hour", "minute", "second" ] parts = [] for unit, val in zip(units, values): if val: parts.append(plugins.pluralise(val, unit)) if len(parts) > 0: description = " and ".join(parts).replace(" and ", ", ", len(parts) - 2) else: description = "Less than 1 second" return line.replace(str(perf) + " sec.", description)
def messageAfterPerform(self): if self.latestNumberOfRecomputations == 0: return "No test needed recomputation." else: return "Recomputed status of " + plugins.pluralise(self.latestNumberOfRecomputations, "test") + "."
def getFinalMessage(self, latestTestCount): if latestTestCount == 0: return "No test needed recomputation." else: return "Recomputed status of " + plugins.pluralise(latestTestCount, "test") + "."
def messageAfterPerform(self): if self.latestTestCount == 0: return "No test was split." else: return "Split result files for " + plugins.pluralise(self.latestTestCount, "test") + "."
def addAdditionalText(self, test): rerunCount = self.getRerunCount(test) if rerunCount and self.hasSucceeded(): self.briefText = "after " + plugins.pluralise(rerunCount, "rerun")