summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytest-forked/setup-hook.sh
blob: 360ddfdfdaf5721fefa07af4bdf2cbc7433c7c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pytestForkedHook() {
    appendToVar pytestFlags "--forked"

    # Using --forked on darwin leads to crashes when fork safety is
    # enabled. This often happens when urllib tries to request proxy
    # settings on MacOS through `urllib.request.getproxies()`
    # - https://github.com/python/cpython/issues/77906
    if [[ "$OSTYPE" == "darwin"* ]]; then
        export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
    fi
}

if [ -z "${dontUsePytestForked-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
    # The flags should be added before pytestCheckHook runs in preDistPhases.
    postInstallCheckHooks+=(pytestForkedHook)
fi