Files
computer-playbook/scripts/install/dev-extras.sh
T
kevinveenbirkenbachandClaude Opus 4.8 1a908a6e5b perf(tests): parallelize suites, hoist fixtures, gate ansible-lint
Run the python suites through pytest-xdist when pytest is importable
(id-level collection parity with unittest discover verified per suite;
serial unittest stays the fallback), with -rP so warnings printed by
passing tests, like the update annotations, still reach the log. run.sh
self-provisions the dev extras through scripts/install/dev-extras.sh,
which stamps inside the venv and skips read-only venvs; make onboard
pre-warms the same path in the running container.

Hoist per-test cache resets and roles scans to setUpClass in the lookup
and resolvable suites (a per-test fingerprint-memo reset closes an
id()-reuse cache-poisoning flake the hoist exposed), inject generation
names into the nfs backup script test instead of sleeping, and narrow
ansible-lint scope to real ansible content. ansible-lint additionally
sits behind a content fingerprint gate that skips the run when nothing
it walks has changed; without a usable git (container bind mounts) the
gate disables itself and the full run remains.

Drop the import-linter layer and ignore for the deleted deps module;
the contract now locks compose -> common -> env. Measured on the host:
unit 101s to 20s, integration 90s to 24s, lint tests 43s to 19s,
repeated ansible-lint 53s to 0.4s.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 21:20:46 +02:00

30 lines
851 B
Bash
Executable File

#!/usr/bin/env bash
# Install the dev extras into the resolved venv once. A stamp inside the
# venv skips reruns until pyproject.toml changes or the venv is recreated,
# so the container-side install disappears together with its venv.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
cd "${REPO_ROOT}"
# shellcheck source=scripts/meta/env/python.sh
source scripts/meta/env/python.sh
: "${VENV:?no venv resolved}"
STAMP="${VENV%/}/.dev-extras.stamp"
if [[ ! -w "${VENV}" ]]; then
echo "[dev-extras] venv not writable (${VENV}); skipping"
exit 0
fi
if [[ -f "${STAMP}" && "${STAMP}" -nt pyproject.toml ]]; then
echo "[dev-extras] up to date (${STAMP})"
exit 0
fi
bash scripts/install/python.sh dev
touch "${STAMP}"
echo "[dev-extras] installed and stamped (${STAMP})"