[Django] #36677: Parallel test runner runs system checks with database aliases before those aliases are set up

3 views
Skip to first unread message

Django

unread,
Oct 21, 2025, 12:57:12 PM (19 hours ago) Oct 21
to django-...@googlegroups.com
#36677: Parallel test runner runs system checks with database aliases before those
aliases are set up
---------------------------------------------+-----------------------------
Reporter: Jacob Walls | Owner: Jacob Walls
Type: Bug | Status: assigned
Component: Testing framework | Version: 6.0
Severity: Release blocker | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+-----------------------------
#36083 made the parallel test runner run system checks in workers. Well
and good, but the call is done before database aliases are set up.

This should explain the recent failures with the geodjango label on Github
Actions, also reproducible locally, with errors like:

{{{
django.db.utils.OperationalError: connection failed: connection to server
on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database
"django-postgis-other" does not exist
}}}

I'm showing this is fixed with:
{{{#!diff
diff --git a/django/test/runner.py b/django/test/runner.py
index 25089a6db1..73665a63d2 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -463,9 +463,6 @@ 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:
@@ -477,6 +474,10 @@ def _init_worker(
connection._test_serialized_contents = value
connection.creation.setup_worker_connection(_worker_id)

+ if is_spawn_or_forkserver:
+ call_command(
+ "check", stdout=io.StringIO(), stderr=io.StringIO(),
databases=used_aliases
+ )

def _run_subsuite(args):
"""
}}}

Regression in 606fc352799e372928fa2c978ab99f0fb6d6017c.

Interestingly, this specific failure did not manifest until
e8190b370e508648b0f0ee9b86876f97d3997e14.
--
Ticket URL: <https://code.djangoproject.com/ticket/36677>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 21, 2025, 1:04:07 PM (18 hours ago) Oct 21
to django-...@googlegroups.com
#36677: Parallel test runner runs system checks with database aliases before those
aliases are set up
-----------------------------------+---------------------------------------
Reporter: Jacob Walls | Owner: Jacob Walls
Type: Bug | Status: assigned
Component: Testing framework | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted

Comment:

Thank you Jacob for investigating and fixing this!
--
Ticket URL: <https://code.djangoproject.com/ticket/36677#comment:1>

Django

unread,
Oct 21, 2025, 1:12:16 PM (18 hours ago) Oct 21
to django-...@googlegroups.com
#36677: Parallel test runner runs system checks with database aliases before those
aliases are set up
-----------------------------------+---------------------------------------
Reporter: Jacob Walls | Owner: Jacob Walls
Type: Bug | Status: assigned
Component: Testing framework | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+---------------------------------------
Comment (by Jacob Walls):

[https://github.com/django/django/pull/19980 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36677#comment:2>

Django

unread,
Oct 21, 2025, 10:13:36 PM (9 hours ago) Oct 21
to django-...@googlegroups.com
#36677: Parallel test runner runs system checks with database aliases before those
aliases are set up
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
| Walls
Type: Bug | Status: assigned
Component: Testing framework | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36677#comment:3>

Django

unread,
Oct 21, 2025, 10:54:32 PM (9 hours ago) Oct 21
to django-...@googlegroups.com
#36677: Parallel test runner runs system checks with database aliases before those
aliases are set up
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
| Walls
Type: Bug | Status: closed
Component: Testing framework | Version: 6.0
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"b6c9246d0a3ef5f9a40b15cc289b495351eae109" b6c9246d]:
{{{#!CommitTicketReference repository=""
revision="b6c9246d0a3ef5f9a40b15cc289b495351eae109"
Fixed #36677 -- Fixed scheduling of system checks in ParallelTestSuite
workers.

Running system checks in workers must happen after database aliases
are set up.

Regression in 606fc352799e372928fa2c978ab99f0fb6d6017c.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36677#comment:4>

Django

unread,
Oct 21, 2025, 10:55:11 PM (9 hours ago) Oct 21
to django-...@googlegroups.com
#36677: Parallel test runner runs system checks with database aliases before those
aliases are set up
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
| Walls
Type: Bug | Status: closed
Component: Testing framework | Version: 6.0
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls <jacobtylerwalls@…>):

In [changeset:"da9f73c579f173f72fdc4a025de95c366c408e81" da9f73c5]:
{{{#!CommitTicketReference repository=""
revision="da9f73c579f173f72fdc4a025de95c366c408e81"
[6.0.x] Fixed #36677 -- Fixed scheduling of system checks in
ParallelTestSuite workers.

Running system checks in workers must happen after database aliases
are set up.

Regression in 606fc352799e372928fa2c978ab99f0fb6d6017c.

Backport of b6c9246d0a3ef5f9a40b15cc289b495351eae109 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36677#comment:5>
Reply all
Reply to author
Forward
0 new messages