#31169: Parallel test mode not working on MacOS with recent versions of Python 3
-----------------------------------+--------------------------------------
     Reporter:  Brandon Navra      |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  Testing framework  |                  Version:  3.0
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------
Description changed by Brandon Navra:

Old description:

> Python 3.8 on MacOS has changed the default start method for the
> multiprocessing module from `fork` to `spawn`:
> https://docs.python.org/3/library/multiprocessing.html#contexts-and-
> start-methods.
>
> When running tests with the `--parallel` flag, this causes the worker
> processes to fail with {{{django.core.exceptions.AppRegistryNotReady:
> Apps aren't loaded yet.}}} as they no longer have a copy of the parent
> memory state. It can also cause the workers to fail to find the cloned
> dbs ({{django.db.utils.OperationalError: FATAL:  database "xxx_1" does
> not exist}}) as the db test prefix is missing.
>
> I have attached a patch which changes `django.test.runner._init_worker`
> (the worker initialiser for `ParallelTestSuite`) to run django.setup()
> and set the db name to one with the `test_` prefix.

New description:

 Python 3.8 on MacOS has changed the default start method for the
 multiprocessing module from `fork` to `spawn`:
 https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-
 methods.

 When running tests with the `--parallel` flag, this causes the worker
 processes to fail with {{{django.core.exceptions.AppRegistryNotReady: Apps
 aren't loaded yet.}}} as they no longer have a copy of the parent memory
 state. It can also cause the workers to fail to find the cloned dbs (
 {{django.db.utils.OperationalError: FATAL:  database "xxx_1" does not
 exist}} ) as the db test prefix is missing.

 I have attached a patch which changes `django.test.runner._init_worker`
 (the worker initialiser for `ParallelTestSuite`) to run django.setup() and
 set the db name to one with the `test_` prefix.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31169#comment:1>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/068.a2760cb69aec2a8ed57390497df3439a%40djangoproject.com.

Reply via email to