From 3c08d440db6aac9ce99b05a42563f8070669c0e1 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Fri, 20 Sep 2024 16:52:43 +0100 Subject: [PATCH] Skip uninstallable tags in QPY backwards compatibility tests When a tag has been made, but the package has not yet landed on PyPI, the QPY job fails in the environment-building step. This is not actually a failure of the QPY backwards-compatibility guarantees, and it isn't the job of the QPY tests to detect a bad tag anyway. --- test/qpy_compat/process_version.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/test/qpy_compat/process_version.sh b/test/qpy_compat/process_version.sh index 3fc34557b69e..c3afcf3a3a5e 100755 --- a/test/qpy_compat/process_version.sh +++ b/test/qpy_compat/process_version.sh @@ -20,7 +20,7 @@ version=$1 parts=( ${version//./ } ) # qiskit_version is the version under test, We're testing that we can correctly # read the qpy files generated with source version with this version. -qiskit_version=`./qiskit_venv/bin/python -c "import qiskit;print(qiskit.__version__)"` +qiskit_version=$(./qiskit_venv/bin/python -c "import qiskit;print(qiskit.__version__)") qiskit_parts=( ${qiskit_version//./ } ) @@ -43,21 +43,27 @@ fi if [[ ! -d qpy_$version ]] ; then echo "Building venv for qiskit-terra $version" - python -m venv $version + python -m venv "$version" if [[ ${parts[0]} -eq 0 ]] ; then - ./$version/bin/pip install -c qpy_test_constraints.txt "qiskit-terra==$version" + if ! "./$version/bin/pip" install -c qpy_test_constraints.txt "qiskit-terra==$version"; then + echo "Skipping uninstallable version $version"; + exit 0; + fi else - ./$version/bin/pip install -c qpy_test_constraints.txt "qiskit==$version" + if ! "./$version/bin/pip" install -c qpy_test_constraints.txt "qiskit==$version"; then + echo "Skipping uninstallable version $version"; + exit 0; + fi fi - mkdir qpy_$version - pushd qpy_$version + mkdir "qpy_$version" + pushd "qpy_$version" echo "Generating qpy files with qiskit-terra $version" - ../$version/bin/python ../test_qpy.py generate --version=$version + "../$version/bin/python" ../test_qpy.py generate --version="$version" else echo "Using cached QPY files for $version" - pushd qpy_$version + pushd "qpy_$version" fi echo "Loading qpy files from $version with dev qiskit-terra" -../qiskit_venv/bin/python ../test_qpy.py load --version=$version +../qiskit_venv/bin/python ../test_qpy.py load --version="$version" popd -rm -rf ./$version +rm -rf "./$version"