def status(self) -> Status: # HACK: should be cached if self.conditions.status == Status.UNSTABLE: return Status.SKIPPED if self.conditions.status == Status.FAILURE: return Status.FAILURE return merge_statuses([ self.execution.status, self.response.status if self.response else Status.SKIPPED, ])
def result(self) -> ScenarioResult: cases = self._cases.result() subscenarios = StatusedList.collect(s.result() for s in self._subscenarios) return ScenarioResult( label=self._label, status=merge_statuses([cases.status, subscenarios.status]), conditions=self._conditions, cases=cases, subscenarios=subscenarios, )
def test_merge_statuses(statuses: Iterable[Status], expected: Status): assert merge_statuses(statuses) is expected
def collect(children: Iterable[Verification]) -> Verification: children = list(children) status = merge_statuses(child.status for child in children) return Verification(status=status, children=children)
def status(self) -> Status: return merge_statuses( [self.status_code.status, self.headers.status, self.body.status])