Skip to content

Commit

Permalink
Use yaml dumps as explanation of failure or sucess when it is present
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
  • Loading branch information
fmartinsons committed May 9, 2021
1 parent 0d63aff commit e297c9e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tap2junit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import platform

import yamlish
from junit_xml import TestCase, TestSuite

from tap2junit.tap13 import TAP13 as tap13
Expand Down Expand Up @@ -40,10 +41,11 @@ def map_yaml_to_junit(test):
t.stdout = test.comment

elif test.result == "not ok":
raw_yaml = f"\n{yamlish.dumps(yaml)}" if yaml else ""
err_code = yaml.get("exitcode", 0)
err_severity = yaml.get("severity", "")
err_output = yaml.get("stack", "")
error_message = f"{err_severity} ({err_code})"
err_output = yaml.get("stack", "") or raw_yaml
error_message = yaml.get("message", "") or f"{err_severity} ({err_code})"
if err_code < 0 or err_severity == "crashed":
t.add_error_info(error_message, err_output, err_code)
else:
Expand Down

0 comments on commit e297c9e

Please sign in to comment.