From 2bd6fed0351911aa79b5c53f4eb8a6e9389e0bb4 Mon Sep 17 00:00:00 2001 From: David Winiecki Date: Wed, 16 Oct 2024 15:40:01 -0700 Subject: [PATCH] Refs #35849 -- Added a handle_event hook to ParallelTestSuite. --- django/test/runner.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/django/test/runner.py b/django/test/runner.py index 27eb9613e9..3912273b61 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -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)