Tests: Run without creating thumbnails by default

This reduces the thumbnails generated by a tests run from about
5k to less than 10.

In practice, some tests can still reset this userpreference e.g. by calling
`bpy.ops.wm.read_factory_settings()`. Further tweaks are possible
should this still be an issue in the future.

See also blender/blender#153811 and infrastructure/meta#197

Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/153817
This commit is contained in:
Bart van der Braak 2026-02-05 17:29:02 +01:00 • committed by Bastien Montagne
parent 05b5529790
commit 986ffa3aee
2 changed files with 17 additions and 1 deletions

View file

@ -54,7 +54,20 @@ endif()
# Standard Blender arguments for running tests.
# Specify exit code so that if a Python script error happens, the test fails.
set(TEST_BLENDER_EXE_PARAMS
--background --factory-startup --debug-memory --debug-exit-on-error --python-exit-code 1
--background
--factory-startup
--debug-memory
--debug-exit-on-error
--python-exit-code 1
)
# The `TEST_BLENDER_EXE_PARAMS` list might be edited in some cases (see e.g. `add_blender_test_allow_error`).
# This will break in case a parameter contains a `;` that should remain literal,
# instead of being interpreted as a list item separator by CMake.
# So this additional variable is always added after `TEST_BLENDER_EXE_PARAMS`, always as-is.
set(TEST_BLENDER_EXE_PARAMS_NO_THUMB
# Python expression to disable thumbnails creation on blendfile saving.
--python-expr [=[import bpy\;bpy.context.preferences.filepaths.file_preview_type='NONE']=]
)
# Python CTests

View file

@ -52,6 +52,7 @@ function(add_blender_test testname)
""
"${TEST_BLENDER_EXE}"
${TEST_BLENDER_EXE_PARAMS}
"${TEST_BLENDER_EXE_PARAMS_NO_THUMB}"
${ARGN}
)
endfunction()
@ -66,6 +67,7 @@ function(add_blender_test_allow_error testname)
""
"${TEST_BLENDER_EXE}"
${EXE_PARAMS}
"${TEST_BLENDER_EXE_PARAMS_NO_THUMB}"
${ARGN}
)
endfunction()
@ -125,6 +127,7 @@ if(WITH_UI_TESTS)
-p 0 0 800 600
--gpu-backend ${backend}
"${EXE_PARAMS}"
"${TEST_BLENDER_EXE_PARAMS_NO_THUMB}"
"${ARGN}"
)
endfunction()