Exemplo n.º 1
0
    def test_case_report(self,
                         test_uid,
                         suite_uid,
                         case_uid,
                         runner_uid=None,
                         serialized=True):
        """Get a testcase report."""
        report = self.test_report(test_uid,
                                  runner_uid=runner_uid,
                                  serialized=False)

        def is_assertion(obj):
            try:
                return obj['meta_type'] in ('entry', 'assertion')
            except Exception:
                return False

        def case_filter(obj):
            try:
                if obj.uid == case_uid:
                    return True
                return obj.uid == suite_uid or \
                       (obj.category == 'parametrization' and
                        any(entry.uid == case_uid for entry in obj.entries))
            except Exception:
                return False

        report = report.filter(case_filter, is_assertion)
        if serialized:
            return report.serialize(strict=False)
        return report
Exemplo n.º 2
0
    def test_case_report(self, test_uid, suite_uid, case_uid, serialized=True):
        """Get a testcase report."""
        report = self.test_report(test_uid, serialized=False)

        def is_assertion(obj):
            try:
                return obj["meta_type"] in ("entry", "assertion")
            except Exception:
                return False

        def case_filter(obj):
            try:
                if obj.uid == case_uid:
                    return True
                return obj.uid == suite_uid or (
                    obj.category == "parametrization"
                    and any(entry.uid == case_uid for entry in obj.entries)
                )
            except Exception:
                return False

        report = report.filter(case_filter, is_assertion)
        if serialized:
            return report.serialize(strict=False)
        return report
Exemplo n.º 3
0
 def test_report(self, test_uid, serialized=True, exclude_assertions=False):
     """Get a test report."""
     test = self.test(test_uid)
     report = test.result.report
     if exclude_assertions is True:
         report = report.filter(_exclude_assertions_filter)
     if serialized:
         return report.serialize(strict=False)
     return report