From 32650884bbfc26d5b53cbf10c416c9a9aef5b57c Mon Sep 17 00:00:00 2001 From: Nate Rini <nate@schedmd.com> Date: Fri, 2 Jul 2021 13:20:13 -0600 Subject: [PATCH] Testsuite - Improve 41.2 using site-packages in PYTHONPATH Bug 11964 --- testsuite/expect/test41.2 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/testsuite/expect/test41.2 b/testsuite/expect/test41.2 index 294c6fe3c94..51b9a1b4189 100755 --- a/testsuite/expect/test41.2 +++ b/testsuite/expect/test41.2 @@ -111,16 +111,21 @@ foreach content_path [glob -type d $scripts/*] { run_command -nolog -subtest \ "$bin_oasgen generate -i '$spec' -g python --strict-spec=true -o '$pyapi'" - run_command -nolog -subtest \ - "$bin_py3 '$pyapi/setup.py' install --prefix='$pypath'" + # Python requires PYTHONPATH point to the site-packages dir (not a parent) + set py_include_path [string trim [run_command_output -fail \ + "$bin_py3 -c 'import sys; print(\"lib/python%d.%d/site-packages\" % + (sys.version_info\[0\], sys.version_info\[1\]))'" ] ] # Add the installed path to make sure python will find it if { [info exists ::env(PYTHONPATH)] } { - set env(PYTHONPATH) [join [list $pypath:$pyapi $env(PYTHONPATH)] ":"] + set env(PYTHONPATH) [join [list "$pypath/$py_include_path" $pyapi $env(PYTHONPATH)] ":"] } else { - set env(PYTHONPATH) $pypath:$pyapi + set env(PYTHONPATH) "$pypath/$py_include_path:$pyapi" } + run_command -nolog -subtest \ + "$bin_py3 '$pyapi/setup.py' install --prefix='$pypath'" + foreach script [glob -type f $scripts/$content/*.py] { log_debug "running: $script" -- GitLab