uv/plan.fmf

51 lines
1.9 KiB
Text

discover:
how: shell
tests:
- name: Basic smoke test
test: uv --help
require:
- uv
- name: Basic venv creation test
test: uv venv venv --python=python3
require:
- uv
- /usr/bin/python3
- name: Auto-install of third-party interpreters is not enabled
test: |
# Choose an interpreter version that uv can download, but which is
# not the default system Python. A relatively safe way to do this is
# to simply find the oldest available version:
oldest_python="$(
uv python list --only-downloads --output-format=json |
jq --raw-output '.[].version' |
sort --version-sort |
head --lines=1
)"
if output="$(uv venv "venv-${oldest_python}" --python="${oldest_python}" 2>&1)"
then
echo "FAILURE: Python ${oldest_python} was automatically installed!"
else
# An old interpreter version may fail to run even after
# auto-installation, e.g. at the time this was written, 3.7.9
# failed with:
# error while loading shared libraries: libnsl.so.1: cannot open
# shared object file: No such file or directory
# We use a heuristic to distinguish between expected and unexpected
# kinds of failures. We want something like:
# No interpreter found for Python 3.7.9 in managed installations
# or search path
if echo "${output}" | grep -Fi 'no interpreter' >/dev/null
then
echo "SUCCESS: Python ${oldest_python} was not automatically installed."
exit 0
fi
echo "FAILURE: Python ${oldest_python} MAY have been automatically installed!"
fi
echo 'Output of uv venv was:'
echo "${output}"
exit 1
require:
- uv
- jq
execute:
how: tmt