From ba298a32b30eb270ea0bf4f8fc208223d0b40bcd Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 16 Mar 2022 20:47:58 +0000 Subject: Refs #31169 -- Prevented infinite loop in parallel tests with custom test runner when using spawn. Regression in 3b3f38b3b09b0f2373e51406ecb8c9c45d36aebc. Co-Authored-By: Mariusz Felisiak --- django/test/runner.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'django/test') diff --git a/django/test/runner.py b/django/test/runner.py index 89bb6cf1fc..fe30d2289b 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -492,6 +492,7 @@ class ParallelTestSuite(unittest.TestSuite): Even with tblib, errors may still occur for dynamically created exception classes which cannot be unpickled. """ + self.initialize_suite() counter = multiprocessing.Value(ctypes.c_int, 0) pool = multiprocessing.Pool( processes=self.processes, @@ -962,8 +963,6 @@ class DiscoverRunner: def run_suite(self, suite, **kwargs): kwargs = self.get_test_runner_kwargs() runner = self.test_runner(**kwargs) - if hasattr(suite, "initialize_suite"): - suite.initialize_suite() try: return runner.run(suite) finally: -- cgit v1.3