Test entry points with editable install (#84002)

This allows collection of code coverage for the entry points.
pull/84011/head
Matt Clay 2 months ago committed by GitHub
parent 0c8efa29b2
commit facf9186b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,30 +1,45 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu -o pipefail set -eu -o pipefail
function check_entry_points() {
bin_dir="$(dirname "$(command -v pip)")"
for bin in "${bin_dir}/ansible"*; do
name="$(basename "${bin}")"
entry_point="${name//ansible-/}"
entry_point="${entry_point//ansible/adhoc}"
echo "=== ${name} (${entry_point})=${bin} ==="
if [ "${name}" == "ansible-test" ]; then
"${bin}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*"
python.py -m ansible "${entry_point}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*"
else
"${bin}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)"
python.py -m ansible "${entry_point}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)"
fi
done
}
source virtualenv.sh source virtualenv.sh
set +x set +x
unset PYTHONPATH unset PYTHONPATH # this causes the test to fail if it was started from an existing virtual environment
base_dir="$(dirname "$(dirname "$(dirname "$(dirname "${OUTPUT_DIR}")")")")" base_dir="$(dirname "$(dirname "$(dirname "$(dirname "${OUTPUT_DIR}")")")")"
bin_dir="$(dirname "$(command -v pip)")"
# deps are already installed, using --no-deps to avoid re-installing them # deps are already installed, using --no-deps to avoid re-installing them
pip install "${base_dir}" --disable-pip-version-check --no-deps pip_options=(--disable-pip-version-check --no-deps)
# --use-feature=in-tree-build not available on all platforms
for bin in "${bin_dir}/ansible"*; do echo "==> check entry points using an editable install"
name="$(basename "${bin}")"
entry_point="${name//ansible-/}" pip install -e "${base_dir}" "${pip_options[@]}"
entry_point="${entry_point//ansible/adhoc}" check_entry_points
pip uninstall -y ansible-core
echo "=== ${name} (${entry_point})=${bin} ===" echo "==> check entry points using a normal install"
if [ "${name}" == "ansible-test" ]; then pip install "${base_dir}" "${pip_options[@]}"
"${bin}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*" check_entry_points
python -m ansible "${entry_point}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*" pip uninstall -y ansible-core
else
"${bin}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)"
python -m ansible "${entry_point}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)"
fi
done

Loading…
Cancel
Save