Beispiel #1
0
    def afterTestRun(self, event):
        evt = events.ReportSummaryEvent(event, self.stream,
                                        self.reportCategories)

        self.stream.setLinkInfo()
        self.stream.setProcessStackTraceLink(False)

        if evt.stopTestEvent.result.wasSuccessful():
            with self.stream.resultCtx(
                    self._mapTestResultCode(result.PASS, True)):
                resultPlugin.ResultReporter.afterTestRun(self, event)
        else:
            cats = evt.reportCategories
            errors = cats.get("errors", [])
            failures = cats.get("failures", [])
            for err in errors:
                self._reportErrorSummary("ERROR", err)

            for fail in failures:
                self._reportErrorSummary("FAIL", fail)

            for flavour, events_ in cats.items():
                if flavour in self.dontReport:
                    continue

                for ev in events_:
                    self._reportErrorSummary(flavour.upper(), ev)

            with self.stream.resultCtx(
                    self._mapTestResultCode(result.FAIL, False)):
                self._printSummary(evt)
Beispiel #2
0
    def _reportSummary(self, event):
        self.stream.writeln('')
        # let others print something
        evt = events.ReportSummaryEvent(event, self.stream,
                                        self.reportCategories)
        self.session.hooks.beforeErrorList(evt)
        # allows other plugins to mess with report categories
        cats = evt.reportCategories
        errors = cats.get('errors', [])
        failures = cats.get('failures', [])
        # use evt.stream so plugins can replace/wrap/spy it
        self._printErrorList('ERROR', errors, evt.stream)
        self._printErrorList('FAIL', failures, evt.stream)

        for flavour, events_ in cats.items():
            if flavour in self.dontReport:
                continue
            self._printErrorList(flavour.upper(), events_, evt.stream)
        self._printSummary(evt)