Exemplo n.º 1
0
    def form_test_report(self, test, err=None, status=None):
        time = self._timeTaken()
        id = test.id()
        actions = test.test_actions
        priority = test.priority

        if not status:
            status = 'success'

        report = {
            'classname': id_split(id)[0],
            'name': id_split(id)[-1],
            'actions': actions,
            'time': time,
            'status': status,
            'priority': priority,
            'systemout': self._getCapturedStdout(),
            'systemerr': self._getCapturedStderr(),
        }

        if err:
            report['error'] = {
                'type': nice_classname(err[0]),
                'message': exc_message(err),
                'tb': format_exception(err),
            }

        self.testcases.append(report)
Exemplo n.º 2
0
    def form_test_report(self, test, err=None, status=None):
        time = self._timeTaken()
        id = test.id()
        actions = test.test_actions
        priority = test.priority

        if not status:
            status = 'success'

        report = {
            'classname': id_split(id)[0],
            'name': id_split(id)[-1],
            'actions': actions,
            'time': time,
            'status': status,
            'priority': priority,
            'systemout': self._getCapturedStdout(),
            'systemerr': self._getCapturedStderr(),
        }

        if err:
            report['error'] = {
                'type': nice_classname(err[0]),
                'message': exc_message(err),
                'tb': format_exception(err),
            }

        self.testcases.append(report)
Exemplo n.º 3
0
 def print_tracebacks(self, label, items):
     problem_color = {"ERROR": "error", "FAIL": "failure"}[label]
     for item in items:
         test, trace = item
         desc = test.shortDescription() or six.text_type(test)
         self.stream.writeln("=" * 70)
         self.stream.writeln("%s: %s" % (
             self.color[problem_color](label),
             self.identifier(desc, bold=True),
         ))
         self.stream.writeln("-" * 70)
         # format_exception() is...very odd re: how it breaks into lines.
         trace = "".join(format_exception(trace)).split("\n")
         self.print_colorized_traceback(trace)
Exemplo n.º 4
0
 def print_tracebacks(self, label, items):
     problem_color = {
         "ERROR": "error",
         "FAIL": "failure"
     }[label]
     for item in items:
         test, trace = item
         desc = test.shortDescription() or six.text_type(test)
         self.stream.writeln("=" * 70)
         self.stream.writeln("%s: %s" % (
             self.color[problem_color](label),
             self.identifier(desc, bold=True),
         ))
         self.stream.writeln("-" * 70)
         # format_exception() is...very odd re: how it breaks into lines.
         trace = "".join(format_exception(trace)).split("\n")
         self.print_colorized_traceback(trace)