Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store check result modified during interpretation #3540

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions tmt/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,11 @@ def interpret_check_result(
:returns: :py:class:`ResultOutcome` instance with the interpreted result
"""

# Process only relevant checks
checks = [check for check in self.check if check.name == check_name]

# Reduce all check outcomes into a single worst outcome
reduced_outcome = ResultOutcome.reduce(
[check.result for check in self.check if check.name == check_name]
)
reduced_outcome = ResultOutcome.reduce([check.result for check in checks])

# Now let's handle the interpretation
interpret = interpret_checks[check_name]
Expand All @@ -414,6 +415,8 @@ def interpret_check_result(
elif interpret == CheckResultInterpret.INFO:
interpreted_outcome = ResultOutcome.INFO
self.note.append(f"check '{check_name}' is informational")
for check in checks:
check.result = ResultOutcome.INFO

elif interpret == CheckResultInterpret.XFAIL:
if reduced_outcome == ResultOutcome.PASS:
Expand All @@ -424,6 +427,13 @@ def interpret_check_result(
interpreted_outcome = ResultOutcome.PASS
self.note.append(f"check '{check_name}' failed as expected")

for check in checks:
if check.result == ResultOutcome.PASS:
check.result = ResultOutcome.FAIL

elif check.result == ResultOutcome.FAIL:
check.result = ResultOutcome.PASS

return interpreted_outcome

def interpret_result(
Expand Down