#36596: django_test_expected_failures has no effect on the parallel test runner
in
"spawn" mode
-----------------------------------+------------------------------------
Reporter: Jacob Walls | Owner: (none)
Type: Bug | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: multiprocessing | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Description changed by Jacob Walls:
Old description:
> The [https://docs.djangoproject.com/en/5.2/releases/3.2/#database-
> backends django_test_expected_failures] method has no effect on the
> parallel test runner in "spawn" multiprocessing mode, because it uses
> `setattr` to
> [https://github.com/django/django/blob/4e7a991c12a113229e0927974d3bf94ea04eecf6/django/db/backends/base/creation.py#L365
> monkey-patch] a class, and that patching is lost when workers are
> spawned.
>
> To reproduce:
> - add `multiprocessing.set_start_method("spawn")` near the top of
> runtests.py if not running on MacOS or Windows
> - adjust postgres database settings to include `"OPTIONS": {
> "server_side_binding": True}` (to trigger an expected failure),
> - `./runtests.py aggregation.tests --settings=test_postgres --parallel=1`
> : passes
> - `./runtests.py aggregation.tests --settings=test_postgres`: fails
>
> Python will be defaulting all systems into "spawn" by default in Python
> 3.14, so we're about to see more traffic into this.
New description:
The [https://docs.djangoproject.com/en/5.2/releases/3.2/#database-backends
django_test_expected_failures] attribute has no effect on the parallel
test runner in "spawn" multiprocessing mode, because it uses `setattr` to
[https://github.com/django/django/blob/4e7a991c12a113229e0927974d3bf94ea04eecf6/django/db/backends/base/creation.py#L365
monkey-patch] a class, and that patching is lost when workers are spawned.
To reproduce:
- add `multiprocessing.set_start_method("spawn")` near the top of
runtests.py if not running on MacOS or Windows
- adjust postgres database settings to include `"OPTIONS": {
"server_side_binding": True}` (to trigger an expected failure),
- `./runtests.py aggregation.tests --settings=test_postgres --parallel=1`
: passes
- `./runtests.py aggregation.tests --settings=test_postgres`: fails
Python will be defaulting all systems into "spawn" by default in Python
3.14, so we're about to see more traffic into this.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/36596#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019919bfd9e5-b564aa7a-0fff-46ae-9430-5bec4a8d7697-000000%40eu-central-1.amazonses.com.