diff options
author | Matt Clay <matt@mystile.com> | 2024-09-24 20:23:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 20:23:20 +0200 |
commit | facf9186b437ec0243502d6d6a01b59cbc2ef7e2 (patch) | |
tree | 7d0683c9386810a0e00dbaf25871d2d65c955985 | |
parent | Ansible Errors, Don't hide stacked messages when yaml (#83933) (diff) | |
download | ansible-facf9186b437ec0243502d6d6a01b59cbc2ef7e2.tar.xz ansible-facf9186b437ec0243502d6d6a01b59cbc2ef7e2.zip |
Test entry points with editable install (#84002)
This allows collection of code coverage for the entry points.
-rwxr-xr-x | test/integration/targets/entry_points/runme.sh | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/test/integration/targets/entry_points/runme.sh b/test/integration/targets/entry_points/runme.sh index f8d6fe5f17..a376a26711 100755 --- a/test/integration/targets/entry_points/runme.sh +++ b/test/integration/targets/entry_points/runme.sh @@ -1,30 +1,45 @@ #!/usr/bin/env bash 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 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}")")")")" -bin_dir="$(dirname "$(command -v pip)")" # deps are already installed, using --no-deps to avoid re-installing them -pip install "${base_dir}" --disable-pip-version-check --no-deps -# --use-feature=in-tree-build not available on all platforms +pip_options=(--disable-pip-version-check --no-deps) -for bin in "${bin_dir}/ansible"*; do - name="$(basename "${bin}")" +echo "==> check entry points using an editable install" - entry_point="${name//ansible-/}" - entry_point="${entry_point//ansible/adhoc}" +pip install -e "${base_dir}" "${pip_options[@]}" +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 - "${bin}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*" - python -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 -m ansible "${entry_point}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)" - fi -done +pip install "${base_dir}" "${pip_options[@]}" +check_entry_points +pip uninstall -y ansible-core |