diff --git a/test/qpy_compat/run_tests.sh b/test/qpy_compat/run_tests.sh index 3717d1c712db..a6ff67b14a94 100755 --- a/test/qpy_compat/run_tests.sh +++ b/test/qpy_compat/run_tests.sh @@ -14,6 +14,7 @@ set -e set -o pipefail set -x +shopt -s nullglob # Set fixed hash seed to ensure set orders are identical between saving and # loading. @@ -23,11 +24,22 @@ echo "PYTHONHASHSEED=$PYTHONHASHSEED" our_dir="$(realpath -- "$(dirname -- "${BASH_SOURCE[0]}")")" repo_root="$(realpath -- "$our_dir/../..")" +# First, prepare a wheel file for the dev version. We install several venvs with this, and while +# cargo will cache some rust artefacts, it still has to re-link each time, so the wheel build takes +# a little while. +wheel_dir="$(pwd -P)/wheels" +python -m pip wheel --no-deps --wheel-dir "$wheel_dir" "$repo_root" +all_wheels=("$wheel_dir"/*.whl) +qiskit_dev_wheel="${all_wheels[0]}" + +# Now set up a "base" development-version environment, which we'll use for most of the backwards +# compatibility checks. qiskit_venv="$(pwd -P)/venvs/dev" qiskit_python="$qiskit_venv/bin/python" python -m venv "$qiskit_venv" + # `packaging` is needed for the `get_versions.py` script. -"$qiskit_venv/bin/pip" install -c "$repo_root/constraints.txt" "$repo_root" packaging +"$qiskit_venv/bin/pip" install -c "$repo_root/constraints.txt" "$qiskit_dev_wheel" packaging # Run all of the tests of cross-Qiskit-version compatibility. "$qiskit_python" "$our_dir/get_versions.py" | parallel --colsep=" " bash "$our_dir/process_version.sh" -p "$qiskit_python" @@ -58,7 +70,7 @@ for i in "${!symengine_versions[@]}"; do symengine_venv="$symengine_venv_prefix$i" files_dir="$symengine_files_prefix$i" python -m venv "$symengine_venv" - "$symengine_venv/bin/pip" install -c "$repo_root/constraints.txt" "$repo_root" "symengine$specifier" + "$symengine_venv/bin/pip" install -c "$repo_root/constraints.txt" "$qiskit_dev_wheel" "symengine$specifier" mkdir -p "$files_dir" pushd "$files_dir" "$symengine_venv/bin/python" -c 'import symengine; print(symengine.__version__)' > "SYMENGINE_VERSION"