Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix failing tests of hid.write on MacOS by pulling target functions t…
…o top of module (#1344) Resolves #1343. On MacOS, the tests of `hid.write.ProcessWithResult` fail because the multiprocessing module tries to pickle the inlined target functions so it can then spawn child processes. To be picklable, functions need to be defined with `def` in the top level of a module[[1](https://docs.python.org/3/library/pickle.html#what-can-be-pickled-and-unpickled)]. On MacOS, multiprocessing uses spawn instead of fork[[2](python/cpython@17a5588)], so this is a problem that does not show up on Linux[[3](https://docs.python.org/3.11/library/multiprocessing.html#the-spawn-and-forkserver-start-methods)]. After moving the definitions of these functions to the top level of the module, the tests pass both on MacOS and on Linux running on CircleCI. <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1344"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a> --------- Co-authored-by: Andrew M. Farrell <armorsmith42@gmail.com>
- Loading branch information