When pytest Froze My Mac: Following the Launch Services Trail
My Mac kept freezing. Everything visible stopped: text, graphs, menus, switching Spaces. Activity Monitor froze along with the rest of the desktop, so it could not show me what was happening.
When the display started updating again, launchservicesd sometimes showed more than 200% CPU. The efficiency cores looked saturated. I suspected something deep in macOS.
The cause turned out to be a cosmetic feature of my Python test runner: changing a worker's process name to show which test it was running.
If your Mac becomes unresponsive during parallel pytest runs and launchservicesd gets busy, check whether pytest-xdist is repeatedly updating worker titles through setproctitle. Another project, BenchBox, has documented this same combination and a successful workaround. We found their report after following the evidence on my machine. Since the title updates stopped, the freezes have not come back.