scipy: tests with `multiprocessing` hang on Python 3.8 on macOS

I’m running the whole test suite on macOS on Python 3.8 (via Github Actions on my local machine (Catalina)). I’m seeing several issues with multiprocessing, such as #11827.

They’re related to https://bugs.python.org/issue38501. The tests that hang are:

I think the best thing to do at the moment is to use the skipif decorator (possibly also coupled to Darwin):

    @pytest.mark.skipif(multiprocessing.get_start_method() != 'fork',
                        reason=('multiprocessing with spawn method is not'
                                ' compatible with pytest.'))

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

@peterbell10, you’re correct. Just tested out on local machine.

  • just the presence of import multiprocessing is enough to prevent hanging (freeze_support not required).
  • the tests don’t hang if there’s no import of multiprocessing and runtests.py uses parallelisation, I used -j 4.

It’s a bit crufty that just the presence of the import is enough…

Pure speculation, but is it possible that adding import multiprocessing to runtests.py was what made the difference? It might change how the python module is initialised on the spawned process.