From e297c9e50de21223bba435e00da5d01c792aa9fd Mon Sep 17 00:00:00 2001 From: Frederic Martinsons Date: Sun, 9 May 2021 09:18:09 +0200 Subject: [PATCH] Use yaml dumps as explanation of failure or sucess when it is present Signed-off-by: Frederic Martinsons --- tap2junit/__main__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tap2junit/__main__.py b/tap2junit/__main__.py index 14cbd9c..59f9f2e 100644 --- a/tap2junit/__main__.py +++ b/tap2junit/__main__.py @@ -2,6 +2,7 @@ import os import platform +import yamlish from junit_xml import TestCase, TestSuite from tap2junit.tap13 import TAP13 as tap13 @@ -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: