From 606fc352799e372928fa2c978ab99f0fb6d6017c Mon Sep 17 00:00:00 2001 From: Adam Zapletal Date: Sat, 18 Jan 2025 16:22:10 -0600 Subject: Fixed #36083 -- Ran system checks in ParallelTestSuite workers. Workers created by ParallelTestSuite were not running system checks in the spawn multiprocessing mode. In general this is fine, but system checks can have side effects expected by tests. This patch runs system checks inside of _init_worker, which is only called by ParallelTestSuite. --- django/test/runner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'django') diff --git a/django/test/runner.py b/django/test/runner.py index 1bfeca03af..8902dea3e0 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -439,7 +439,7 @@ def _init_worker( used_aliases=None, ): """ - Switch to databases dedicated to this worker. + Switch to databases dedicated to this worker and run system checks. This helper lives at module-level because of the multiprocessing module's requirements. @@ -463,6 +463,9 @@ def _init_worker( process_setup(*process_setup_args) django.setup() setup_test_environment(debug=debug_mode) + call_command( + "check", stdout=io.StringIO(), stderr=io.StringIO(), databases=used_aliases + ) db_aliases = used_aliases if used_aliases is not None else connections for alias in db_aliases: -- cgit v1.3