#36596: django_test_expected_failures has no effect on the parallel test runner in
"spawn" mode
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Type: Bug
Status: new | Component: Testing
| framework
Version: dev | Severity: Normal
Keywords: multiprocessing | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
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.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36596>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.