From ddeb2534ad879d6985b9c6e0850f3b7f6055efbf Mon Sep 17 00:00:00 2001 From: mck Date: Fri, 12 Jun 2026 22:37:46 +0200 Subject: [PATCH] =?UTF-8?q?SQUASH=20=E2=80=93=20cqlsh-test=20fixes=20(not?= =?UTF-8?q?=20complete)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Force pip's legacy pkg_resources metadata backend (instead of the importlib.metadata backend that pip defaults to on Python 3.11+). When pip reinstalls the editable VCS cassandra-driver it git-checks-out over the existing src/cassandra-driver tree, removing its egg-info mid-resolution. The importlib backend then reads a version-less editable dist and crashes with "TypeError: expected string or bytes-like object, got 'NoneType'", whereas the legacy backend tolerates the missing metadata. (Requires pip < 25.1, which still ships the pkg_resources backend. See ubuntu-test.docker) --- .build/docker/run-tests.sh | 1 + .build/docker/ubuntu-test.docker | 13 +++++++++---- .build/run-tests.sh | 2 -- pylib/cassandra-cqlsh-tests.sh | 6 ++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.build/docker/run-tests.sh b/.build/docker/run-tests.sh index 50c1d3bf9e..2357a77872 100755 --- a/.build/docker/run-tests.sh +++ b/.build/docker/run-tests.sh @@ -300,6 +300,7 @@ echo "Running container ${container_name} ${docker_id} using image ${image_name} docker exec --user root ${container_name} bash -c "\${CASSANDRA_DIR}/.build/docker/_create_user.sh cassandra $(id -u) $(id -g)" | tee -a ${logfile} docker exec --user root ${container_name} update-alternatives --set python /usr/bin/python${python_version} | tee -a ${logfile} +docker exec --user root ${container_name} update-alternatives --set python3 /usr/bin/python${python_version} | tee -a ${logfile} if [ -n "${DTEST_TMPDIR_LOCAL}" ] && [[ "${target}" =~ ^dtest-upgrade ]] ; then # prepopulate a tmp ccm repository directory, if running dtest-upgrade tests diff --git a/.build/docker/ubuntu-test.docker b/.build/docker/ubuntu-test.docker index 2c52ec94e3..47b26307f0 100644 --- a/.build/docker/ubuntu-test.docker +++ b/.build/docker/ubuntu-test.docker @@ -60,10 +60,15 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ RUN update-alternatives --remove java /usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/jre/bin/java RUN update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/bin/java 1081 RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 2 -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 3 -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 4 -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.13 5 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.13 1 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 1 RUN python3.8 -m pip install --upgrade pip # generate locales for the standard en_US.UTF8 value we use for testing diff --git a/.build/run-tests.sh b/.build/run-tests.sh index b56ebbf2a2..7d62231377 100755 --- a/.build/run-tests.sh +++ b/.build/run-tests.sh @@ -24,8 +24,6 @@ set -o errexit set -o pipefail -[ $DEBUG ] && set -x - # variables, with defaults [ "x${CASSANDRA_DIR}" != "x" ] || CASSANDRA_DIR="$(readlink -f $(dirname -- "$0")/..)" [ "x${DIST_DIR}" != "x" ] || DIST_DIR="${CASSANDRA_DIR}/build" diff --git a/pylib/cassandra-cqlsh-tests.sh b/pylib/cassandra-cqlsh-tests.sh index 7c0caf69a1..511e5d9743 100755 --- a/pylib/cassandra-cqlsh-tests.sh +++ b/pylib/cassandra-cqlsh-tests.sh @@ -23,6 +23,8 @@ # ################################ +[ $DEBUG ] && set -x + WORKSPACE=$1 [ "x${WORKSPACE}" != "x" ] || WORKSPACE="$(readlink -f $(dirname "$0")/..)" @@ -63,6 +65,10 @@ rm -fr ${DIST_DIR}/venv ${DIST_DIR}/test/{html,output,logs} virtualenv-clone ${BUILD_HOME}/env${python_version} ${BUILD_DIR}/venv || virtualenv --python=python3 ${BUILD_DIR}/venv source ${BUILD_DIR}/venv/bin/activate +# Force pip's legacy pkg_resources metadata backend (instead of the importlib.metadata +# backend that pip defaults to on Python 3.11+). see ubuntu-test.docker +export _PIP_USE_IMPORTLIB_METADATA=0 + pip install --exists-action w -r ${CASSANDRA_DIR}/pylib/requirements.txt pip freeze