mirror of
https://github.com/django/django.git
synced 2025-01-03 15:06:09 +00:00
Refs #35849 -- Added a handle_event hook to ParallelTestSuite.
This commit is contained in:
parent
c4c076223e
commit
41da8a4f5a
@ -547,18 +547,21 @@ class ParallelTestSuite(unittest.TestSuite):
|
|||||||
|
|
||||||
tests = list(self.subsuites[subsuite_index])
|
tests = list(self.subsuites[subsuite_index])
|
||||||
for event in events:
|
for event in events:
|
||||||
event_name = event[0]
|
self.handle_event(result, tests, event)
|
||||||
handler = getattr(result, event_name, None)
|
|
||||||
if handler is None:
|
|
||||||
continue
|
|
||||||
test = tests[event[1]]
|
|
||||||
args = event[2:]
|
|
||||||
handler(test, *args)
|
|
||||||
|
|
||||||
pool.join()
|
pool.join()
|
||||||
|
|
||||||
return result
|
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):
|
def __iter__(self):
|
||||||
return iter(self.subsuites)
|
return iter(self.subsuites)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user