My whole Mac kept freezing during test runs. Menus, graphs, even switching Spaces.
Turned out pytest-xdist renames its worker processes before and after every test, and macOS did not cope well with that. Since I switched it off, the freezes haven't come back.
How I tracked it down: https://wersdoerfer.de/blogs/ephes_blog/pytest-macos-desktop-freezes/