1pytestForkedHook() {
2 appendToVar pytestFlags "--forked"
3
4 # Using --forked on darwin leads to crashes when fork safety is
5 # enabled. This often happens when urllib tries to request proxy
6 # settings on MacOS through `urllib.request.getproxies()`
7 # - https://github.com/python/cpython/issues/77906
8 if [[ "$OSTYPE" == "darwin"* ]]; then
9 export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
10 fi
11}
12
13if [ -z "${dontUsePytestForked-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
14 # The flags should be added before pytestCheckHook runs in preDistPhases.
15 postInstallCheckHooks+=(pytestForkedHook)
16fi