Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / pytest-forked / setup-hook.sh
blobe613feadf8346e01205c410c3cb47f3350e603a5
1 pytestForkedHook() {
2 pytestFlagsArray+=(
3 "--forked"
6 # Using --forked on darwin leads to crashes when fork safety is
7 # enabled. This often happens when urllib tries to request proxy
8 # settings on MacOS through `urllib.request.getproxies()`
9 # - https://github.com/python/cpython/issues/77906
10 if [[ "$OSTYPE" == "darwin"* ]]; then
11 export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
15 # the flags should be added before pytestCheckHook runs so
16 # until we have dependency mechanism in generic builder, we need to use this ugly hack.
18 if [ -z "${dontUsePytestForked-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
19 if [[ " ${preDistPhases:-} " =~ " pytestCheckPhase " ]]; then
20 preDistPhases+=" "
21 preDistPhases="${preDistPhases/ pytestCheckPhase / pytestForkedHook pytestCheckPhase }"
22 else
23 preDistPhases+=" pytestForkedHook"