Skip to content

Commit 633cc4b

Browse files
authored
Merge pull request #5018 from Flamefire/20251007122536_new_pr_XPJPAxSjWb
Improve test report formatting
2 parents 121b4b0 + 0250933 commit 633cc4b

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

easybuild/tools/testing.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,21 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_
237237
else:
238238
build_overview = ["#### Overview of tested easyconfigs (in order)"]
239239
for (ec, ec_res) in ecs_with_res:
240-
test_log = ''
240+
additional_info = ''
241241
if ec_res.get('success', False):
242242
test_result = 'SUCCESS'
243+
error_descr = ''
243244
else:
245+
test_result = 'FAIL'
244246
# compose test result string
245-
test_result = 'FAIL '
246247
if 'err' in ec_res:
247248
if isinstance(ec_res['err'], EasyBuildError):
248-
test_result += '(build issue)'
249+
error_descr = '(build issue)'
249250
else:
250-
test_result += '(unhandled exception: %s)' % ec_res['err']
251-
test_result += ec_res['traceback']
251+
error_descr = '(unhandled exception: `%s`)' % ec_res['err']
252+
additional_info = f"```\n{ec_res['traceback']}\n```"
252253
else:
253-
test_result += '(unknown cause, not an exception?!)'
254+
error_descr = '(unknown cause, not an exception?!)'
254255

255256
# create gist for log file (if desired and available)
256257
if gist_log and 'log_file' in ec_res:
@@ -266,9 +267,12 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_
266267

267268
fn = '%s_partial.log' % os.path.basename(ec['spec'])[:-3]
268269
gist_url = create_gist(partial_log_txt, fn, descr=descr, github_user=github_user)
269-
test_log = "(partial log available at %s)" % gist_url
270+
additional_info += f"(partial log available at {gist_url})"
270271

271-
build_overview.append(" * **%s** _%s_ %s" % (test_result, os.path.basename(ec['spec']), test_log))
272+
filename = os.path.basename(ec['spec'])
273+
if error_descr:
274+
error_descr = f"**{error_descr}**" # Make bold if set
275+
build_overview.append(f" * **{test_result}** _{filename}_ {error_descr}\n {additional_info}")
272276
build_overview.append("")
273277
test_report.extend(build_overview)
274278

test/framework/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ def test_github_create_test_report(self):
13701370
res = create_test_report("just a test", ecs_with_res, init_session_state)
13711371
patterns = [
13721372
"**SUCCESS** _test.eb_",
1373-
"**FAIL (build issue)** _fail.eb_",
1373+
"**FAIL** _fail.eb_ **(build issue)**",
13741374
"01 Jan 1970 00:00:00",
13751375
"EASYBUILD_DEBUG=1",
13761376
"USER = test",

0 commit comments

Comments
 (0)