From 3d1c8a3ff302d09cfd8d454bbd8bd0bd53137c61 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Tue, 14 May 2024 19:02:00 +0300 Subject: [PATCH] Compositor: Explicitly set device in test scripts This patch explicitly sets the compositing device in the compositor test scripts. This is done to make the tests more robust, since a developer might accordantly save a file with a different device. --- tests/python/compositor_cpu_render_tests.py | 7 +++++-- tests/python/compositor_realtime_render_tests.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/python/compositor_cpu_render_tests.py b/tests/python/compositor_cpu_render_tests.py index d9abae801fd..ab5ca4ec03e 100644 --- a/tests/python/compositor_cpu_render_tests.py +++ b/tests/python/compositor_cpu_render_tests.py @@ -15,6 +15,9 @@ try: except ImportError: inside_blender = False +SET_COMPOSITOR_DEVICE_SCRIPT = "import bpy; " \ + "bpy.data.scenes[0].render.compositor_device = 'CPU'" + def get_arguments(filepath, output_filepath): return [ @@ -24,8 +27,8 @@ def get_arguments(filepath, output_filepath): "--debug-memory", "--debug-exit-on-error", filepath, - "-P", - os.path.realpath(__file__), + "-P", os.path.realpath(__file__), + "--python-expr", SET_COMPOSITOR_DEVICE_SCRIPT, "-o", output_filepath, "-F", "PNG", "-f", "1"] diff --git a/tests/python/compositor_realtime_render_tests.py b/tests/python/compositor_realtime_render_tests.py index 17de8393e09..04e67e21bb1 100644 --- a/tests/python/compositor_realtime_render_tests.py +++ b/tests/python/compositor_realtime_render_tests.py @@ -15,7 +15,7 @@ try: except ImportError: inside_blender = False -ENABLE_REALTIME_COMPOSITOR_SCRIPT = "import bpy; " \ +SET_COMPOSITOR_DEVICE_SCRIPT = "import bpy; " \ "bpy.data.scenes[0].render.compositor_device = 'GPU'" @@ -28,7 +28,7 @@ def get_arguments(filepath, output_filepath): "--debug-exit-on-error", filepath, "-P", os.path.realpath(__file__), - "--python-expr", ENABLE_REALTIME_COMPOSITOR_SCRIPT, + "--python-expr", SET_COMPOSITOR_DEVICE_SCRIPT, "-o", output_filepath, "-F", "PNG", "-f", "1"