From d2d36c65fa769a92c1b51d59fbf6c604faba7b7e Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 7 Oct 2025 12:25:36 +0200 Subject: [PATCH 1/4] Improve test report formatting --- easybuild/tools/testing.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/easybuild/tools/testing.py b/easybuild/tools/testing.py index 32dd24178b..74c24cb9bd 100644 --- a/easybuild/tools/testing.py +++ b/easybuild/tools/testing.py @@ -237,20 +237,21 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_ else: build_overview = ["#### Overview of tested easyconfigs (in order)"] for (ec, ec_res) in ecs_with_res: - test_log = '' + additional_info = '' if ec_res.get('success', False): test_result = 'SUCCESS' + test_result_descr = '' else: + test_result = 'FAIL' # compose test result string - test_result = 'FAIL ' if 'err' in ec_res: if isinstance(ec_res['err'], EasyBuildError): - test_result += '(build issue)' + test_result_descr = '(build issue)' else: - test_result += '(unhandled exception: %s)' % ec_res['err'] - test_result += ec_res['traceback'] + test_result_descr = '(unhandled exception: `%s`)' % ec_res['err'] + additional_info = f"```{ec_res['traceback']}\n```" else: - test_result += '(unknown cause, not an exception?!)' + test_result_descr = '(unknown cause, not an exception?!)' # create gist for log file (if desired and available) if gist_log and 'log_file' in ec_res: @@ -266,9 +267,10 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_ fn = '%s_partial.log' % os.path.basename(ec['spec'])[:-3] gist_url = create_gist(partial_log_txt, fn, descr=descr, github_user=github_user) - test_log = "(partial log available at %s)" % gist_url + additional_info += "(partial log available at %s)" % gist_url - build_overview.append(" * **%s** _%s_ %s" % (test_result, os.path.basename(ec['spec']), test_log)) + filename = os.path.basename(ec['spec']) + build_overview.append(f" * **{test_result}** _{filename}_ {test_result_descr}\n {additional_info}") build_overview.append("") test_report.extend(build_overview) From 822faebe67bf4b224b408084399490795a4323d9 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 7 Oct 2025 12:36:12 +0200 Subject: [PATCH 2/4] make extended status bold --- easybuild/tools/testing.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/easybuild/tools/testing.py b/easybuild/tools/testing.py index 74c24cb9bd..2b3641b002 100644 --- a/easybuild/tools/testing.py +++ b/easybuild/tools/testing.py @@ -240,18 +240,18 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_ additional_info = '' if ec_res.get('success', False): test_result = 'SUCCESS' - test_result_descr = '' + error_descr = '' else: test_result = 'FAIL' # compose test result string if 'err' in ec_res: if isinstance(ec_res['err'], EasyBuildError): - test_result_descr = '(build issue)' + error_descr = '(build issue)' else: - test_result_descr = '(unhandled exception: `%s`)' % ec_res['err'] + error_descr = '(unhandled exception: `%s`)' % ec_res['err'] additional_info = f"```{ec_res['traceback']}\n```" else: - test_result_descr = '(unknown cause, not an exception?!)' + error_descr = '(unknown cause, not an exception?!)' # create gist for log file (if desired and available) if gist_log and 'log_file' in ec_res: @@ -267,10 +267,12 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_ fn = '%s_partial.log' % os.path.basename(ec['spec'])[:-3] gist_url = create_gist(partial_log_txt, fn, descr=descr, github_user=github_user) - additional_info += "(partial log available at %s)" % gist_url + additional_info += f"(partial log available at {gist_url})" filename = os.path.basename(ec['spec']) - build_overview.append(f" * **{test_result}** _{filename}_ {test_result_descr}\n {additional_info}") + if error_descr: + error_descr = f"**{error_descr}**" # Make bold if set + build_overview.append(f" * **{test_result}** _{filename}_ {error_descr}\n {additional_info}") build_overview.append("") test_report.extend(build_overview) From 1c32d9ef2e0cb8850c12b6d66ea7c7c14160a4ef Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 7 Oct 2025 12:38:21 +0200 Subject: [PATCH 3/4] Fix formatting --- easybuild/tools/testing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/tools/testing.py b/easybuild/tools/testing.py index 2b3641b002..dfc78ea5cc 100644 --- a/easybuild/tools/testing.py +++ b/easybuild/tools/testing.py @@ -271,7 +271,7 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_ filename = os.path.basename(ec['spec']) if error_descr: - error_descr = f"**{error_descr}**" # Make bold if set + error_descr = f"**{error_descr}**" # Make bold if set build_overview.append(f" * **{test_result}** _{filename}_ {error_descr}\n {additional_info}") build_overview.append("") test_report.extend(build_overview) From 8b92e940321b677e1ff7b41b61d912363822625b Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 7 Oct 2025 13:09:04 +0200 Subject: [PATCH 4/4] Adapt test --- test/framework/github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/framework/github.py b/test/framework/github.py index c80e496cf2..7f1800988f 100644 --- a/test/framework/github.py +++ b/test/framework/github.py @@ -1355,7 +1355,7 @@ def test_github_create_test_report(self): res = create_test_report("just a test", ecs_with_res, init_session_state) patterns = [ "**SUCCESS** _test.eb_", - "**FAIL (build issue)** _fail.eb_", + "**FAIL** _fail.eb_ **(build issue)**", "01 Jan 1970 00:00:00", "EASYBUILD_DEBUG=1", "USER = test",