summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorDavid Winiecki <david.winiecki@gmail.com>2024-10-16 15:40:01 -0700
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-11-06 17:14:41 +0100
commit41da8a4f5a55c11fb28d2a172a7ad2cff53ca9ec (patch)
treea40c323617bb3c007a54442a684093744c8da7af /django/test
parentc4c076223eb73553d3bc8fbc11be2c529d9aea6b (diff)
Refs #35849 -- Added a handle_event hook to ParallelTestSuite.
Diffstat (limited to 'django/test')
-rw-r--r--django/test/runner.py17
1 files 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)