示例#1
0
 def __str__(self):
     ret_str = """\
               id = %s
               name = %s
               date = %s
               testId = %s
               testUid = %s
               comment = %s
               tags = %s
               """ % ( self._id,
                       self._name,
                       self._started,
                       self._testId,
                       self._testUid,
                       self._comment,
                       " ".join(self._tags))
     ret_str = textwrap.dedent(ret_str)
     ret_str += "parameters:\n"
     for param in self._parameters:
         ret_str +=  indent("%s = %s\n" % (param[0], param[1]), 4)
     ret_str += "values:\n"
     for val in self._values:
         ret_str +=  indent(str(val), 4)
         ret_str +=  indent("------------------------\n", 4)
     return textwrap.dedent(ret_str)
示例#2
0
 def __str__(self):
     ret_str = """\
               id = %s
               uid = %s
               name = %s
               groupid = %s
               description:
               """ % ( self._id,
                       self._uid,
                       self._name,
                       self._groupid)
     ret_str = textwrap.dedent(ret_str)
     ret_str += indent(self._description + "\n", 4)
     ret_str += "metrics:\n"
     for metric in self._metrics:
         ret_str += indent(str(metric), 4)
         ret_str += indent("------------------------\n", 4)
     return textwrap.dedent(ret_str)
示例#3
0
 def __str__(self):
     ret_str = """\
               metric name = %s
               result = %s
               """ % ( self._metricName,
                       self._result)
     ret_str = textwrap.dedent(ret_str)
     ret_str += "parameters:\n"
     for param in self._parameters:
         ret_str +=  indent("%s = %s\n" % (param[0], param[1]), 4)
     return textwrap.dedent(ret_str)
示例#4
0
 def __str__(self):
     ret_str = """\
               id = %s
               name = %s
               comparator = %s
               description:
               """ % ( self._id,
                       self._name,
                       self._comparator)
     ret_str = textwrap.dedent(ret_str)
     ret_str += indent(self._description + "\n", 4)
     return ret_str
示例#5
0
    def format_run(self, run):
        if not isinstance(run, RecipeRun):
            raise RunFormatterException("run must be a RecipeRun instance.")

        output_lines = []
        output_lines.append("RUN SUMMARY")
        output_lines.append("Description:")
        if run.description:
            output_lines.extend(str(run.description).split("\n"))

        output_lines.extend(format_match_description(run.match).split('\n'))

        filtered_results = [res for res in run.results if
                            res.success == False or res.level <= self._level]
        for i, res in enumerate(filtered_results):
            try:
                next_res = filtered_results[i+1]
                if (isinstance(res, JobStartResult) and
                    isinstance(next_res, JobFinishResult) and
                    res.job.host == next_res.job.host and
                    res.job.id == next_res.job.id and
                    res.success):
                    continue
            except IndexError:
                pass

            output_lines.append("{res} {src}{desc}".format(
                res = self._format_success(res.success),
                src = self._format_source(res),
                desc = ("\t{}".format(res.description)
                    if res.description.count('\n') == 0
                    else "\n{}".format(indent(res.description, 4)))))

            if res.data_level <= self._level:
                output_lines.extend(self._format_data(res.data))

        output_lines.append("Overall result of this Run: {}".
                            format(self._format_success(run.overall_result)))

        return "\n".join(output_lines)