From f99b35463a0581c31dad386c258f82bd72df8705 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Tue, 24 Jun 2025 19:27:36 +0200 Subject: [PATCH] Tests: Remove suite level `apply_modifiers` option for modifier tests The `apply_modifiers` property of the `RunTest` class overrides all of the test level `apply_modifier` properties. This prevents modifiers from manually specifying when a modifier is applied and forces the modifier to be applied immediately after it is added. The vast majority of tests do not override the `apply_modifier` property, the primary usecase for this property is to work in combination with the `do_compare` property to allow examining the corresponding .blend file to debug test failures. This commit simplifies the settings by removing this parameter. It now only disables applying the modifier if `do_compare` is set to False. Pull Request: https://projects.blender.org/blender/blender/pulls/140893 --- tests/python/deform_modifiers.py | 2 -- tests/python/modifiers.py | 2 -- tests/python/modules/mesh_test.py | 9 ++++++--- tests/python/physics_cloth.py | 2 -- tests/python/physics_dynamic_paint.py | 2 -- tests/python/physics_ocean.py | 2 -- tests/python/physics_particle_instance.py | 2 -- tests/python/physics_particle_system.py | 2 -- tests/python/physics_softbody.py | 2 -- 9 files changed, 6 insertions(+), 19 deletions(-) diff --git a/tests/python/deform_modifiers.py b/tests/python/deform_modifiers.py index 818ad76bc7c..980c59bcc50 100644 --- a/tests/python/deform_modifiers.py +++ b/tests/python/deform_modifiers.py @@ -91,12 +91,10 @@ deform_tests = RunTest(tests) command = list(sys.argv) for i, cmd in enumerate(command): if cmd == "--run-all-tests": - deform_tests.apply_modifiers = True deform_tests.do_compare = True deform_tests.run_all_tests() break elif cmd == "--run-test": - deform_tests.apply_modifiers = False deform_tests.do_compare = False name = command[i + 1] deform_tests.run_test(name) diff --git a/tests/python/modifiers.py b/tests/python/modifiers.py index ea4e4ddb20d..6b82bcf0fc4 100644 --- a/tests/python/modifiers.py +++ b/tests/python/modifiers.py @@ -342,12 +342,10 @@ def main(): command = list(sys.argv) for i, cmd in enumerate(command): if cmd == "--run-all-tests": - modifiers_test.apply_modifiers = True modifiers_test.do_compare = True modifiers_test.run_all_tests() break elif cmd == "--run-test": - modifiers_test.apply_modifiers = False modifiers_test.do_compare = False name = command[i + 1] modifiers_test.run_test(name) diff --git a/tests/python/modules/mesh_test.py b/tests/python/modules/mesh_test.py index 1cd51d651fc..700b81eaeb0 100644 --- a/tests/python/modules/mesh_test.py +++ b/tests/python/modules/mesh_test.py @@ -814,7 +814,7 @@ class RunTest: >>> modifiers_test.run_all_tests() """ - def __init__(self, tests, apply_modifiers=False, do_compare=False): + def __init__(self, tests, do_compare=False): """ Construct a test suite. @@ -825,10 +825,11 @@ class RunTest: 2) expected_object_name: bpy.Types.Object - expected object 3) modifiers or operators: list - list of mesh_test.ModifierSpec objects or mesh_test.OperatorSpecEditMode objects + :arg do_compare: bool - Whether the result mesh will be compared with the provided golden mesh. When set to False + the modifier is not applied so the result can be examined inside Blender. """ self.tests = tests self._ensure_unique_test_name_or_raise_error() - self.apply_modifiers = apply_modifiers self.do_compare = do_compare self.verbose = os.environ.get("BLENDER_VERBOSE") is not None self._failed_tests_list = [] @@ -895,7 +896,9 @@ class RunTest: raise Exception('No test called {} found!'.format(test_name)) test = case - test.apply_modifier = self.apply_modifiers + if not self.do_compare: + test.apply_modifier = False + test.do_compare = self.do_compare success = test.run_test() diff --git a/tests/python/physics_cloth.py b/tests/python/physics_cloth.py index a549d391bb2..c4d4d503e58 100644 --- a/tests/python/physics_cloth.py +++ b/tests/python/physics_cloth.py @@ -35,12 +35,10 @@ def main(): command = list(sys.argv) for i, cmd in enumerate(command): if cmd == "--run-all-tests": - cloth_test.apply_modifiers = True cloth_test.do_compare = True cloth_test.run_all_tests() break elif cmd == "--run-test": - cloth_test.apply_modifiers = False cloth_test.do_compare = False name = command[i + 1] cloth_test.run_test(name) diff --git a/tests/python/physics_dynamic_paint.py b/tests/python/physics_dynamic_paint.py index a7d6322ebfe..1159fe2f6b8 100644 --- a/tests/python/physics_dynamic_paint.py +++ b/tests/python/physics_dynamic_paint.py @@ -26,12 +26,10 @@ def main(): command = list(sys.argv) for i, cmd in enumerate(command): if cmd == "--run-all-tests": - dynamic_paint_test.apply_modifiers = True dynamic_paint_test.do_compare = True dynamic_paint_test.run_all_tests() break elif cmd == "--run-test": - dynamic_paint_test.apply_modifiers = False dynamic_paint_test.do_compare = False name = command[i + 1] dynamic_paint_test.run_test(name) diff --git a/tests/python/physics_ocean.py b/tests/python/physics_ocean.py index acab8e74586..0a08d6c7fd9 100644 --- a/tests/python/physics_ocean.py +++ b/tests/python/physics_ocean.py @@ -22,12 +22,10 @@ def main(): command = list(sys.argv) for i, cmd in enumerate(command): if cmd == "--run-all-tests": - ocean_test.apply_modifiers = True ocean_test.do_compare = True ocean_test.run_all_tests() break elif cmd == "--run-test": - ocean_test.apply_modifiers = False ocean_test.do_compare = False name = command[i + 1] ocean_test.run_test(name) diff --git a/tests/python/physics_particle_instance.py b/tests/python/physics_particle_instance.py index 54f1f0edb27..a86321cfa09 100644 --- a/tests/python/physics_particle_instance.py +++ b/tests/python/physics_particle_instance.py @@ -24,12 +24,10 @@ def main(): command = list(sys.argv) for i, cmd in enumerate(command): if cmd == "--run-all-tests": - particle_instance_test.apply_modifiers = True particle_instance_test.do_compare = True particle_instance_test.run_all_tests() break elif cmd == "--run-test": - particle_instance_test.apply_modifiers = False particle_instance_test.do_compare = False name = command[i + 1] particle_instance_test.run_test(name) diff --git a/tests/python/physics_particle_system.py b/tests/python/physics_particle_system.py index 558915fe372..3f48885975d 100644 --- a/tests/python/physics_particle_system.py +++ b/tests/python/physics_particle_system.py @@ -27,12 +27,10 @@ def main(): command = list(sys.argv) for i, cmd in enumerate(command): if cmd == "--run-all-tests": - particle_test.apply_modifiers = True particle_test.do_compare = True particle_test.run_all_tests() break elif cmd == "--run-test": - particle_test.apply_modifiers = False particle_test.do_compare = False name = command[i + 1] particle_test.run_test(name) diff --git a/tests/python/physics_softbody.py b/tests/python/physics_softbody.py index b30d456db51..c703ee1c183 100644 --- a/tests/python/physics_softbody.py +++ b/tests/python/physics_softbody.py @@ -24,12 +24,10 @@ def main(): command = list(sys.argv) for i, cmd in enumerate(command): if cmd == "--run-all-tests": - soft_body_test.apply_modifiers = True soft_body_test.do_compare = True soft_body_test.run_all_tests() break elif cmd == "--run-test": - soft_body_test.apply_modifiers = False soft_body_test.do_compare = False name = command[i + 1] soft_body_test.run_test(name)