[4.1.x] Fixed #33891 -- Fixed test command crash when running in parallel using spawn.
Thanks Kevin Renskers for the report. Regression in41c4cb253c
. Backport ofd4db417c8e
from main
This commit is contained in:
parent
2ae024c744
commit
ab860d4e48
|
@ -443,6 +443,11 @@ def _run_subsuite(args):
|
||||||
return subsuite_index, result.events
|
return subsuite_index, result.events
|
||||||
|
|
||||||
|
|
||||||
|
def _process_setup_stub(*args):
|
||||||
|
"""Stub method to simplify run() implementation."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ParallelTestSuite(unittest.TestSuite):
|
class ParallelTestSuite(unittest.TestSuite):
|
||||||
"""
|
"""
|
||||||
Run a series of tests in parallel in several processes.
|
Run a series of tests in parallel in several processes.
|
||||||
|
@ -461,6 +466,7 @@ class ParallelTestSuite(unittest.TestSuite):
|
||||||
|
|
||||||
# In case someone wants to modify these in a subclass.
|
# In case someone wants to modify these in a subclass.
|
||||||
init_worker = _init_worker
|
init_worker = _init_worker
|
||||||
|
process_setup = _process_setup_stub
|
||||||
process_setup_args = ()
|
process_setup_args = ()
|
||||||
run_subsuite = _run_subsuite
|
run_subsuite = _run_subsuite
|
||||||
runner_class = RemoteTestRunner
|
runner_class = RemoteTestRunner
|
||||||
|
@ -474,14 +480,6 @@ class ParallelTestSuite(unittest.TestSuite):
|
||||||
self.serialized_contents = None
|
self.serialized_contents = None
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def process_setup(self, *args):
|
|
||||||
"""
|
|
||||||
Stub method to simplify run() implementation. "self" is never actually
|
|
||||||
passed because a function implementing this method (__func__) is
|
|
||||||
always used, not the method itself.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def run(self, result):
|
def run(self, result):
|
||||||
"""
|
"""
|
||||||
Distribute test cases across workers.
|
Distribute test cases across workers.
|
||||||
|
|
|
@ -14,3 +14,7 @@ Bugfixes
|
||||||
|
|
||||||
* Fixed a regression in Django 4.1 that caused a crash of admin's autocomplete
|
* Fixed a regression in Django 4.1 that caused a crash of admin's autocomplete
|
||||||
widgets when translations are deactivated (:ticket:`33888`).
|
widgets when translations are deactivated (:ticket:`33888`).
|
||||||
|
|
||||||
|
* Fixed a regression in Django 4.1 that caused a crash of the ``test``
|
||||||
|
management command when running in parallel and ``multiprocessing`` start
|
||||||
|
method is ``spawn`` (:ticket:`33891`).
|
||||||
|
|
Loading…
Reference in New Issue