Skip to content

Commit ddfb546

Browse files
committed
code review comments
1 parent ca41944 commit ddfb546

1 file changed

Lines changed: 14 additions & 34 deletions

File tree

RLTest/__main__.py

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -772,15 +772,15 @@ def _runTest(self, test, numberOfAssertionFailed=0, prefix='', before=lambda x=N
772772
numFailed += 1 # exception should be counted as failure
773773
return numFailed
774774

775-
def _ensureGitHubActionsGroupOpen(self):
776-
"""Ensure a GitHub Actions group is open for passing/skipped tests"""
777-
if self.github_actions_group_open is False:
778-
print('::group::✅ Passing/Skipped Tests')
775+
def _openGitHubActionsTestsGroup(self):
776+
"""Open a GitHub Actions group wrapping all tests"""
777+
if is_github_actions() and self.github_actions_group_open is False:
778+
print('::group::📋 Test Execution')
779779
self.github_actions_group_open = True
780780

781-
def _closeGitHubActionsGroup(self):
782-
"""Close the current GitHub Actions group if one is open"""
783-
if self.github_actions_group_open is True:
781+
def _closeGitHubActionsTestsGroup(self):
782+
"""Close the GitHub Actions tests group if one is open"""
783+
if is_github_actions() and self.github_actions_group_open is True:
784784
print('::endgroup::')
785785
self.github_actions_group_open = False
786786

@@ -929,28 +929,7 @@ def on_timeout():
929929
# we must update the bar anyway to see output
930930
bar.__next__()
931931

932-
# Capture output if not disabled
933-
if self.args.no_output_catch:
934-
# No output capturing - run test directly
935-
count, _ = self.run_single_test(test, on_timeout)
936-
done += count
937-
else:
938-
# Capture output and print with proper grouping
939-
output = io.StringIO()
940-
with redirect_stdout(output):
941-
count, passed = self.run_single_test(test, on_timeout)
942-
done += count
943-
944-
# Print captured output with proper grouping
945-
captured = output.getvalue()
946-
if captured:
947-
if not passed:
948-
# Close group before printing failure output
949-
self._closeGitHubActionsGroup()
950-
else:
951-
# Ensure group is open for passing test output
952-
self._ensureGitHubActionsGroupOpen()
953-
print(captured, end='')
932+
done += self.run_single_test(test, on_timeout)
954933

955934
self.takeEnvDown(fullShutDown=True)
956935

@@ -993,6 +972,8 @@ def on_timeout():
993972

994973
results = Queue()
995974
summary = Queue()
975+
# Open group for all tests at the start (parallel execution)
976+
self._openGitHubActionsTestsGroup()
996977
if self.parallelism == 1:
997978
run_jobs_main_thread(jobs)
998979
else :
@@ -1018,11 +999,6 @@ def on_timeout():
1018999
if not has_live_processor:
10191000
raise Exception('Failed to get job result and no more processors is alive')
10201001
output = res['output']
1021-
passed = res['passed']
1022-
if not passed:
1023-
self._closeGitHubActionsGroup()
1024-
else:
1025-
self._ensureGitHubActionsGroupOpen()
10261002
print('%s' % output, end="")
10271003

10281004
for p in processes:
@@ -1039,6 +1015,10 @@ def on_timeout():
10391015

10401016
endTime = time.time()
10411017

1018+
# Close group after all tests complete (parallel execution)
1019+
self._closeGitHubActionsTestsGroup()
1020+
1021+
# Summary goes outside the group
10421022
print(Colors.Bold('\nTest Took: %d sec' % (endTime - startTime)))
10431023
print(Colors.Bold('Total Tests Run: %d, Total Tests Failed: %d, Total Tests Passed: %d' % (done, self.getFailedTestsCount(), done - self.getFailedTestsCount())))
10441024
if self.testsFailed:

0 commit comments

Comments
 (0)