Skip to content

Commit

Permalink
Propagate result phase into report plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
seberm committed Jul 22, 2024
1 parent 5e6db4b commit eb5475a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tmt/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ class CheckResult(BaseResult):
unserialize=CheckEvent.from_spec)


@dataclasses.dataclass
class PhaseResult(BaseResult):
""" Describes what tmt knows about a single test phase result (sub-result) """

check: list[CheckResult] = field(
default_factory=cast(Callable[[], list[CheckResult]], list),
serialize=lambda results: [result.to_serialized() for result in results],
unserialize=lambda serialized: [
CheckResult.from_serialized(check) for check in serialized]
)


@dataclasses.dataclass
class Result(BaseResult):
""" Describes what tmt knows about a single test result """
Expand All @@ -159,6 +171,13 @@ class Result(BaseResult):
unserialize=lambda serialized: ResultGuestData.from_serialized(serialized)
)

phase: list[PhaseResult] = field(
default_factory=cast(Callable[[], list[PhaseResult]], list),
serialize=lambda results: [result.to_serialized() for result in results],
unserialize=lambda serialized: [
PhaseResult.from_serialized(phase) for phase in serialized]
)

check: list[CheckResult] = field(
default_factory=cast(Callable[[], list[CheckResult]], list),
serialize=lambda results: [result.to_serialized() for result in results],
Expand Down

0 comments on commit eb5475a

Please sign in to comment.