[Bf-blender-cvs] [1d936a98e4f] temp-usd-export-unittest: Test runner: On Linux, use Python from the precompiled libraries

Sybren A. Stüvel noreply at git.blender.org
Fri Apr 10 10:35:23 CEST 2020


Commit: 1d936a98e4f9dcf929a0ac282eb76aba8a1ce62d
Author: Sybren A. Stüvel
Date:   Fri Apr 10 10:35:17 2020 +0200
Branches: temp-usd-export-unittest
https://developer.blender.org/rB1d936a98e4f9dcf929a0ac282eb76aba8a1ce62d

Test runner: On Linux, use Python from the precompiled libraries

CentOS on the buildbot still runs Python 3.6, which is also used for the
unit tests. This means that the tests can't use language features that are
available to Blender itself. And testing with a different version of Python
than will be used by the actual code seems like a bad idea to me.

===================================================================

M	tests/CMakeLists.txt
M	tests/python/CMakeLists.txt

===================================================================

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 94b6e49181c..acd3f6ba18f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -20,7 +20,18 @@ elseif(APPLE)
   set(TEST_PYTHON_EXE)
 else()
   set(TEST_BLENDER_EXE ${TEST_INSTALL_DIR}/blender)
-  set(TEST_PYTHON_EXE)
+
+  if(EXISTS ${PYTHON_EXECUTABLE})
+    message(STATUS "Using Python from PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")
+    set(TEST_PYTHON_EXE ${PYTHON_EXECUTABLE})
+  else()
+    set(_python_exe "${LIBDIR}/python/bin/python${PYTHON_VERSION}m")
+    if(EXISTS ${_python_exe})
+      message(STATUS "Using Python from pre-compiled LIBDIR: ${_python_exe}")
+      set(TEST_PYTHON_EXE ${_python_exe})
+    endif()
+    unset(_python_exe)
+  endif()
 endif()
 
 # For testing with Valgrind
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 42ab6057c67..80b104df08c 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -48,7 +48,7 @@ endfunction()
 
 # Run Python script outside Blender.
 function(add_python_test testname testscript)
-  if(MSVC)
+  if(TEST_PYTHON_EXE)
     add_test(
       NAME ${testname}
       COMMAND ${TEST_PYTHON_EXE} ${testscript} ${ARGN}



More information about the Bf-blender-cvs mailing list