Files
Eduardo OlivaresandClaude Opus 4.8 911dc91ed4 Fix plugin-sanity-check venv collision with PEP 832 .venv redirect
virtualenv >= 21.12.0 implements the provisional PEP 832 feature that, when
an environment is created, drops a ".venv" redirect file in the nearest
parent directory holding a pyproject.toml (and without a .venv yet). The
tempest repository root holds a pyproject.toml, so when tox builds the
plugin-sanity-check environment a ".venv" text file is written there,
pointing at ".tox/plugin-sanity-check".

prepare_workspace() in tools/tempest-plugin-sanity.sh then runs
"python3 -m venv .venv" without removing a pre-existing .venv. Python's
stdlib venv refuses to create an environment over an existing non-directory
and fails with "Unable to create directory", breaking the job on the first
plugin. This has been failing every change since 2026-09-24 (virtualenv
21.12.0 release) and still reproduces with virtualenv 21.14.5.

Create the sanity virtualenv in a ".virtualenv" directory instead, so it no
longer collides with the PEP 832 redirect, and point with_venv.sh (used
only by this script) at it. The redirect file is left untouched. The new
directory is also added to the .gitignore and flake8 exclude lists.

Closes-Bug: #2169582
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change-Id: I9082a7c366ec4986f586fc7cf21371bcf98c53f0
Signed-off-by: Eduardo Olivares <eolivare@redhat.com>
2026-10-05 19:14:38 +02:00

7 lines
212 B
Bash
Executable File

#!/usr/bin/env bash
TOOLS_PATH=${TOOLS_PATH:-$(dirname $0)/../}
VENV_PATH=${VENV_PATH:-${TOOLS_PATH}}
VENV_DIR=${VENV_DIR:-/.virtualenv}
VENV=${VENV:-${VENV_PATH}/${VENV_DIR}}
source ${VENV}/bin/activate && "$@"