pytest-flask icon indicating copy to clipboard operation
pytest-flask copied to clipboard

Forcing multiprocessing spawn on macOS

Open northernSage opened this issue 4 years ago • 2 comments

Following #138

From multiprocessing docs ,

"On macOS, the spawn start method is now the default..."

This causes LiveServer to throw a pickling error on py39. For now, we are explicitly forcing "fork" method for starting processes in LiveServer. As the docs specify, this is not adequate. Some research on this will be necessary and probably some changes in LiveServer.

northernSage avatar Jun 04 '21 18:06 northernSage

The current way of forcing fork is not correct either,

if platform.system() == "Darwin":
    multiprocessing.set_start_method("fork")

this is too blunt an instrument, and will even fail if set_start_method has already been called. I think pytest-flask should be doing the following:

if platform.system() == "Darwin":
    multiprocessing = multiprocessing.get_context("fork")

RazerM avatar Nov 09 '21 08:11 RazerM

Thanks for pointing it out @RazerM. The alternative seems reasonable and we would be glad to review a PR for this 👍🏻

northernSage avatar Dec 05 '21 01:12 northernSage