示例#1
0
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
示例#2
0
    def getTitle(self):
        title = "Tests: "
        if self.versionString and len(self.versionString) > 40:
            reducedVersionString = self.versionString[:40] + "..."
        else:
            reducedVersionString = self.versionString

        if self.testSuiteSelection:
            # We don't care about totals with test suites
            title += plugins.pluralise(self.nofSelectedTests,
                                       "suite") + " selected"
            if self.versionString:
                title += ", " + reducedVersionString
            elif 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.versionString:
                title += ", " + reducedVersionString
            elif 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
示例#3
0
 def addAdditionalText(self, test):
     rerunCount = self.getRerunCount(test)
     if rerunCount and self.hasSucceeded():
         self.briefText = "after " + plugins.pluralise(rerunCount, "rerun")
示例#4
0
 def getFinalMessage(self, latestTestCount):
     if latestTestCount == 0:
         return "No test needed recomputation."
     else:
         return "Recomputed status of " + plugins.pluralise(
             latestTestCount, "test") + "."
示例#5
0
 def messageAfterPerform(self):
     if self.latestTestCount == 0:
         return "No test was split."
     else:
         return "Split result files for " + plugins.pluralise(
             self.latestTestCount, "test") + "."