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
This commit is contained in:
@@ -91,12 +91,10 @@ deform_tests = RunTest(tests)
|
|||||||
command = list(sys.argv)
|
command = list(sys.argv)
|
||||||
for i, cmd in enumerate(command):
|
for i, cmd in enumerate(command):
|
||||||
if cmd == "--run-all-tests":
|
if cmd == "--run-all-tests":
|
||||||
deform_tests.apply_modifiers = True
|
|
||||||
deform_tests.do_compare = True
|
deform_tests.do_compare = True
|
||||||
deform_tests.run_all_tests()
|
deform_tests.run_all_tests()
|
||||||
break
|
break
|
||||||
elif cmd == "--run-test":
|
elif cmd == "--run-test":
|
||||||
deform_tests.apply_modifiers = False
|
|
||||||
deform_tests.do_compare = False
|
deform_tests.do_compare = False
|
||||||
name = command[i + 1]
|
name = command[i + 1]
|
||||||
deform_tests.run_test(name)
|
deform_tests.run_test(name)
|
||||||
|
|||||||
@@ -342,12 +342,10 @@ def main():
|
|||||||
command = list(sys.argv)
|
command = list(sys.argv)
|
||||||
for i, cmd in enumerate(command):
|
for i, cmd in enumerate(command):
|
||||||
if cmd == "--run-all-tests":
|
if cmd == "--run-all-tests":
|
||||||
modifiers_test.apply_modifiers = True
|
|
||||||
modifiers_test.do_compare = True
|
modifiers_test.do_compare = True
|
||||||
modifiers_test.run_all_tests()
|
modifiers_test.run_all_tests()
|
||||||
break
|
break
|
||||||
elif cmd == "--run-test":
|
elif cmd == "--run-test":
|
||||||
modifiers_test.apply_modifiers = False
|
|
||||||
modifiers_test.do_compare = False
|
modifiers_test.do_compare = False
|
||||||
name = command[i + 1]
|
name = command[i + 1]
|
||||||
modifiers_test.run_test(name)
|
modifiers_test.run_test(name)
|
||||||
|
|||||||
@@ -814,7 +814,7 @@ class RunTest:
|
|||||||
>>> modifiers_test.run_all_tests()
|
>>> 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.
|
Construct a test suite.
|
||||||
|
|
||||||
@@ -825,10 +825,11 @@ class RunTest:
|
|||||||
2) expected_object_name: bpy.Types.Object - expected object
|
2) expected_object_name: bpy.Types.Object - expected object
|
||||||
3) modifiers or operators: list - list of mesh_test.ModifierSpec objects or
|
3) modifiers or operators: list - list of mesh_test.ModifierSpec objects or
|
||||||
mesh_test.OperatorSpecEditMode objects
|
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.tests = tests
|
||||||
self._ensure_unique_test_name_or_raise_error()
|
self._ensure_unique_test_name_or_raise_error()
|
||||||
self.apply_modifiers = apply_modifiers
|
|
||||||
self.do_compare = do_compare
|
self.do_compare = do_compare
|
||||||
self.verbose = os.environ.get("BLENDER_VERBOSE") is not None
|
self.verbose = os.environ.get("BLENDER_VERBOSE") is not None
|
||||||
self._failed_tests_list = []
|
self._failed_tests_list = []
|
||||||
@@ -895,7 +896,9 @@ class RunTest:
|
|||||||
raise Exception('No test called {} found!'.format(test_name))
|
raise Exception('No test called {} found!'.format(test_name))
|
||||||
|
|
||||||
test = case
|
test = case
|
||||||
test.apply_modifier = self.apply_modifiers
|
if not self.do_compare:
|
||||||
|
test.apply_modifier = False
|
||||||
|
|
||||||
test.do_compare = self.do_compare
|
test.do_compare = self.do_compare
|
||||||
|
|
||||||
success = test.run_test()
|
success = test.run_test()
|
||||||
|
|||||||
@@ -35,12 +35,10 @@ def main():
|
|||||||
command = list(sys.argv)
|
command = list(sys.argv)
|
||||||
for i, cmd in enumerate(command):
|
for i, cmd in enumerate(command):
|
||||||
if cmd == "--run-all-tests":
|
if cmd == "--run-all-tests":
|
||||||
cloth_test.apply_modifiers = True
|
|
||||||
cloth_test.do_compare = True
|
cloth_test.do_compare = True
|
||||||
cloth_test.run_all_tests()
|
cloth_test.run_all_tests()
|
||||||
break
|
break
|
||||||
elif cmd == "--run-test":
|
elif cmd == "--run-test":
|
||||||
cloth_test.apply_modifiers = False
|
|
||||||
cloth_test.do_compare = False
|
cloth_test.do_compare = False
|
||||||
name = command[i + 1]
|
name = command[i + 1]
|
||||||
cloth_test.run_test(name)
|
cloth_test.run_test(name)
|
||||||
|
|||||||
@@ -26,12 +26,10 @@ def main():
|
|||||||
command = list(sys.argv)
|
command = list(sys.argv)
|
||||||
for i, cmd in enumerate(command):
|
for i, cmd in enumerate(command):
|
||||||
if cmd == "--run-all-tests":
|
if cmd == "--run-all-tests":
|
||||||
dynamic_paint_test.apply_modifiers = True
|
|
||||||
dynamic_paint_test.do_compare = True
|
dynamic_paint_test.do_compare = True
|
||||||
dynamic_paint_test.run_all_tests()
|
dynamic_paint_test.run_all_tests()
|
||||||
break
|
break
|
||||||
elif cmd == "--run-test":
|
elif cmd == "--run-test":
|
||||||
dynamic_paint_test.apply_modifiers = False
|
|
||||||
dynamic_paint_test.do_compare = False
|
dynamic_paint_test.do_compare = False
|
||||||
name = command[i + 1]
|
name = command[i + 1]
|
||||||
dynamic_paint_test.run_test(name)
|
dynamic_paint_test.run_test(name)
|
||||||
|
|||||||
@@ -22,12 +22,10 @@ def main():
|
|||||||
command = list(sys.argv)
|
command = list(sys.argv)
|
||||||
for i, cmd in enumerate(command):
|
for i, cmd in enumerate(command):
|
||||||
if cmd == "--run-all-tests":
|
if cmd == "--run-all-tests":
|
||||||
ocean_test.apply_modifiers = True
|
|
||||||
ocean_test.do_compare = True
|
ocean_test.do_compare = True
|
||||||
ocean_test.run_all_tests()
|
ocean_test.run_all_tests()
|
||||||
break
|
break
|
||||||
elif cmd == "--run-test":
|
elif cmd == "--run-test":
|
||||||
ocean_test.apply_modifiers = False
|
|
||||||
ocean_test.do_compare = False
|
ocean_test.do_compare = False
|
||||||
name = command[i + 1]
|
name = command[i + 1]
|
||||||
ocean_test.run_test(name)
|
ocean_test.run_test(name)
|
||||||
|
|||||||
@@ -24,12 +24,10 @@ def main():
|
|||||||
command = list(sys.argv)
|
command = list(sys.argv)
|
||||||
for i, cmd in enumerate(command):
|
for i, cmd in enumerate(command):
|
||||||
if cmd == "--run-all-tests":
|
if cmd == "--run-all-tests":
|
||||||
particle_instance_test.apply_modifiers = True
|
|
||||||
particle_instance_test.do_compare = True
|
particle_instance_test.do_compare = True
|
||||||
particle_instance_test.run_all_tests()
|
particle_instance_test.run_all_tests()
|
||||||
break
|
break
|
||||||
elif cmd == "--run-test":
|
elif cmd == "--run-test":
|
||||||
particle_instance_test.apply_modifiers = False
|
|
||||||
particle_instance_test.do_compare = False
|
particle_instance_test.do_compare = False
|
||||||
name = command[i + 1]
|
name = command[i + 1]
|
||||||
particle_instance_test.run_test(name)
|
particle_instance_test.run_test(name)
|
||||||
|
|||||||
@@ -27,12 +27,10 @@ def main():
|
|||||||
command = list(sys.argv)
|
command = list(sys.argv)
|
||||||
for i, cmd in enumerate(command):
|
for i, cmd in enumerate(command):
|
||||||
if cmd == "--run-all-tests":
|
if cmd == "--run-all-tests":
|
||||||
particle_test.apply_modifiers = True
|
|
||||||
particle_test.do_compare = True
|
particle_test.do_compare = True
|
||||||
particle_test.run_all_tests()
|
particle_test.run_all_tests()
|
||||||
break
|
break
|
||||||
elif cmd == "--run-test":
|
elif cmd == "--run-test":
|
||||||
particle_test.apply_modifiers = False
|
|
||||||
particle_test.do_compare = False
|
particle_test.do_compare = False
|
||||||
name = command[i + 1]
|
name = command[i + 1]
|
||||||
particle_test.run_test(name)
|
particle_test.run_test(name)
|
||||||
|
|||||||
@@ -24,12 +24,10 @@ def main():
|
|||||||
command = list(sys.argv)
|
command = list(sys.argv)
|
||||||
for i, cmd in enumerate(command):
|
for i, cmd in enumerate(command):
|
||||||
if cmd == "--run-all-tests":
|
if cmd == "--run-all-tests":
|
||||||
soft_body_test.apply_modifiers = True
|
|
||||||
soft_body_test.do_compare = True
|
soft_body_test.do_compare = True
|
||||||
soft_body_test.run_all_tests()
|
soft_body_test.run_all_tests()
|
||||||
break
|
break
|
||||||
elif cmd == "--run-test":
|
elif cmd == "--run-test":
|
||||||
soft_body_test.apply_modifiers = False
|
|
||||||
soft_body_test.do_compare = False
|
soft_body_test.do_compare = False
|
||||||
name = command[i + 1]
|
name = command[i + 1]
|
||||||
soft_body_test.run_test(name)
|
soft_body_test.run_test(name)
|
||||||
|
|||||||
Reference in New Issue
Block a user