From d5f9b892c3343a0c139e40999e2102d29d55bbbe Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Wed, 16 Aug 2023 16:12:32 -0300 Subject: [PATCH] plugins: update python plugin test Signed-off-by: Claudio Matsuoka --- tests/unit/parts/plugins/test_python_plugin.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/unit/parts/plugins/test_python_plugin.py b/tests/unit/parts/plugins/test_python_plugin.py index e44a511ba8..242777264e 100644 --- a/tests/unit/parts/plugins/test_python_plugin.py +++ b/tests/unit/parts/plugins/test_python_plugin.py @@ -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. @@ -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