diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 13 | ||||
-rw-r--r-- | tests/blender_as_python_module/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/python/CMakeLists.txt | 2 |
3 files changed, 15 insertions, 2 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 68fcfc89b96..d2fbec7059f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,6 +31,19 @@ elseif(NOT EXISTS ${TEST_PYTHON_EXE}) endif() +# Include these arguments before all others, they must not interfere with Python execution. +set(TEST_PYTHON_EXE_EXTRA_ARGS) + +# Check if this a Blender managed Python installation, if so, don't add `*.pyc` files. +if(LIBDIR) + cmake_path(IS_PREFIX LIBDIR "${TEST_PYTHON_EXE}" NORMALIZE _is_prefix) + if(_is_prefix) + # Keep the Python in Blender's SVN LIBDIR pristine, to avoid conflicts on updating. + set(TEST_PYTHON_EXE_EXTRA_ARGS "-B") + endif() + unset(_is_prefix) +endif() + # For testing with Valgrind # set(TEST_BLENDER_EXE valgrind --track-origins=yes --error-limit=no ${TEST_BLENDER_EXE}) diff --git a/tests/blender_as_python_module/CMakeLists.txt b/tests/blender_as_python_module/CMakeLists.txt index 6e0ce524903..7387d5c41bf 100644 --- a/tests/blender_as_python_module/CMakeLists.txt +++ b/tests/blender_as_python_module/CMakeLists.txt @@ -8,7 +8,7 @@ function(add_blender_as_python_module_test testname testscript) add_test( NAME ${testname} - COMMAND ${TEST_PYTHON_EXE} ${testscript} ${ARGN} + COMMAND ${TEST_PYTHON_EXE} ${TEST_PYTHON_EXE_EXTRA_ARGS} ${testscript} ${ARGN} ) # On macOS, asan library must be loaded early. diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index b3decc06161..0d74cfafda5 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -41,7 +41,7 @@ function(add_python_test testname testscript) add_test( NAME ${testname} - COMMAND ${TEST_PYTHON_EXE} ${testscript} ${ARGN} + COMMAND ${TEST_PYTHON_EXE} ${TEST_PYTHON_EXE_EXTRA_ARGS} ${testscript} ${ARGN} ) set_tests_properties(${testname} PROPERTIES ENVIRONMENT LSAN_OPTIONS=exitcode=0:$ENV{LSAN_OPTIONS} |