Skip to content

Commit

Permalink
python3Packages.pytest-forked: simplify setup hook
Browse files Browse the repository at this point in the history
We need to make sure that pytest-forked's setup hook runs before the
pytestCheckPhase. Instead of mangling the preDistPhases in a complex
way, we can just set our environment variables in postInstallCheckHook,
which is run right before all preDistPhases.
  • Loading branch information
wolfgangwalther committed Dec 9, 2024
1 parent 2a88739 commit 54f0457
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions pkgs/development/python-modules/pytest-forked/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,7 @@ pytestForkedHook() {
fi
}

# the flags should be added before pytestCheckHook runs so
# until we have dependency mechanism in generic builder, we need to use this ugly hack.

if [ -z "${dontUsePytestForked-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
if [[ " ${preDistPhases[*]:-} " =~ " pytestCheckPhase " ]]; then
_preDistPhases="${preDistPhases[*]} "
_preDistPhases="${_preDistPhases/ pytestCheckPhase / pytestForkedHook pytestCheckPhase }"
if [[ -n "${__structuredAttrs-}" ]]; then
preDistPhases=()
else
preDistPhases=""
fi
appendToVar preDistPhases $_preDistPhases
unset _preDistPhases
else
appendToVar preDistPhases pytestForkedHook
fi
# The flags should be added before pytestCheckHook runs in preDistPhases.
postInstallCheckHooks+=(pytestForkedHook)
fi

0 comments on commit 54f0457

Please sign in to comment.