Skip to content

Commit

Permalink
plugins: update python plugin test
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
  • Loading branch information
cmatsuoka authored and sergiusens committed Aug 24, 2023
1 parent cb49eed commit d5f9b89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/unit/parts/plugins/test_python_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@ def test_get_build_commands(plugin, new_dir):
set +e
install_dir="{new_dir}/parts/my-part/install/usr/bin"
stage_dir="{new_dir}/stage/usr/bin"
payload_python=$(find "$install_dir" "$stage_dir" -type f -executable -name "python3.*" -print -quit 2>/dev/null)
# look for the right Python version - if the venv was created with python3.10,
# look for python3.10
basename=$(basename $(readlink -f ${{PARTS_PYTHON_VENV_INTERP_PATH}}))
echo Looking for a Python interpreter called \\"${{basename}}\\" in the payload...
payload_python=$(find "$install_dir" "$stage_dir" -type f -executable -name "${{basename}}" -print -quit 2>/dev/null)
if [ -n "$payload_python" ]; then
# We found a provisioned interpreter, use it.
echo Found interpreter in payload: \\"${{payload_python}}\\"
installed_python="${{payload_python##{new_dir}/parts/my-part/install}}"
if [ "$installed_python" = "$payload_python" ]; then
# Found a staged interpreter.
Expand All @@ -89,6 +95,7 @@ def test_get_build_commands(plugin, new_dir):
fi
else
# Otherwise use what _get_system_python_interpreter() told us.
echo "Python interpreter not found in payload."
symlink_target="/usr/bin/python3.10"
fi
Expand Down

0 comments on commit d5f9b89

Please sign in to comment.