1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #35849 -- Added a handle_event hook to ParallelTestSuite.

This commit is contained in:
David Winiecki 2024-10-16 15:40:01 -07:00 committed by Sarah Boyce
parent c4c076223e
commit 41da8a4f5a

View File

@ -547,18 +547,21 @@ class ParallelTestSuite(unittest.TestSuite):
tests = list(self.subsuites[subsuite_index])
for event in events:
event_name = event[0]
handler = getattr(result, event_name, None)
if handler is None:
continue
test = tests[event[1]]
args = event[2:]
handler(test, *args)
self.handle_event(result, tests, event)
pool.join()
return result
def handle_event(self, result, tests, event):
event_name = event[0]
handler = getattr(result, event_name, None)
if handler is None:
return
test = tests[event[1]]
args = event[2:]
handler(test, *args)
def __iter__(self):
return iter(self.subsuites)