[Bf-blender-cvs] [07e11b54ab5] soc-2020-testing-frameworks: Added a new compare flag `do_compare` for run-test
Himanshi Kalra
noreply at git.blender.org
Sun Sep 6 14:42:29 CEST 2020
Commit: 07e11b54ab5578f65310b9bd5bd7c34b26fb23bc
Author: Himanshi Kalra
Date: Sun Sep 6 18:07:08 2020 +0530
Branches: soc-2020-testing-frameworks
https://developer.blender.org/rB07e11b54ab5578f65310b9bd5bd7c34b26fb23bc
Added a new compare flag `do_compare` for run-test
do_compare is set to False if no comparison is needed, like when running
run-test for investigation purpose
===================================================================
M tests/python/bevel_operator.py
M tests/python/boolean_operator.py
M tests/python/deform_modifiers.py
M tests/python/modifiers.py
M tests/python/modules/mesh_test.py
M tests/python/operators.py
M tests/python/physics_cloth.py
M tests/python/physics_dynamic_paint.py
M tests/python/physics_ocean.py
M tests/python/physics_particle_instance.py
M tests/python/physics_particle_system.py
M tests/python/physics_softbody.py
===================================================================
diff --git a/tests/python/bevel_operator.py b/tests/python/bevel_operator.py
index b9ea6f6b4d0..c732d437b57 100644
--- a/tests/python/bevel_operator.py
+++ b/tests/python/bevel_operator.py
@@ -301,12 +301,12 @@ def main():
command = list(sys.argv)
for i, cmd in enumerate(command):
if cmd == "--run-all-tests":
- operator_test.apply_modifiers = True
+ operator_test.do_compare = True
operator_test.run_all_tests()
break
elif cmd == "--run-test":
name = command[i + 1]
- operator_test.apply_modifiers = False
+ operator_test.do_compare = False
operator_test.run_test(name)
break
diff --git a/tests/python/boolean_operator.py b/tests/python/boolean_operator.py
index 0c66648ab68..0db6a074699 100644
--- a/tests/python/boolean_operator.py
+++ b/tests/python/boolean_operator.py
@@ -69,12 +69,12 @@ def main():
command = list(sys.argv)
for i, cmd in enumerate(command):
if cmd == "--run-all-tests":
- operator_test.apply_modifiers = True
+ operator_test.do_compare = True
operator_test.run_all_tests()
break
elif cmd == "--run-test":
name = command[i + 1]
- operator_test.apply_modifiers = False
+ operator_test.do_compare = False
operator_test.run_test(name)
break
diff --git a/tests/python/deform_modifiers.py b/tests/python/deform_modifiers.py
index 1642cdb6ac1..7c4ea457e9d 100644
--- a/tests/python/deform_modifiers.py
+++ b/tests/python/deform_modifiers.py
@@ -108,10 +108,12 @@ 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)
break
diff --git a/tests/python/modifiers.py b/tests/python/modifiers.py
index d038dc5e632..7d76ff47a46 100644
--- a/tests/python/modifiers.py
+++ b/tests/python/modifiers.py
@@ -349,10 +349,12 @@ def main():
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)
break
diff --git a/tests/python/modules/mesh_test.py b/tests/python/modules/mesh_test.py
index c19ff3c7e99..e6937af3509 100644
--- a/tests/python/modules/mesh_test.py
+++ b/tests/python/modules/mesh_test.py
@@ -170,7 +170,7 @@ class MeshTest:
"""
def __init__(self, test_name: str, test_object_name: str, expected_object_name: str, operations_stack=None,
- apply_modifiers=False, threshold=None):
+ apply_modifiers=False, do_compare=False, threshold=None):
"""
Constructs a MeshTest object. Raises a KeyError if objects with names expected_object_name
or test_object_name don't exist.
@@ -182,6 +182,7 @@ class MeshTest:
:param apply_modifiers: bool - True if we want to apply the modifiers right after adding them to the object.
- True if we want to apply the modifier to a list of modifiers, after some operation.
This affects operations of type ModifierSpec and DeformModifierSpec.
+ :param do_compare: bool - True if we want to compare the test and expected objects, False otherwise.
:param threshold : exponent: To allow variations and accept difference to a certain degree.
"""
@@ -197,6 +198,7 @@ class MeshTest:
type(operation)))
self.operations_stack = operations_stack
self.apply_modifier = apply_modifiers
+ self.do_compare = do_compare
self.threshold = threshold
self.test_name = test_name
@@ -557,8 +559,8 @@ class MeshTest:
type(OperatorSpecObjectMode), type(ParticleSystemSpec), type(operation)))
# Compare resulting mesh with expected one.
- # Compare only when self.modifier is set to True, if modifiers are not applied test will always fail
- if self.apply_modifier:
+ # Compare only when self.do_compare is set to True, it is set to False for run-test
+ if self.do_compare:
if self.verbose:
print("Comparing expected mesh with resulting mesh...")
evaluated_test_mesh = evaluated_test_object.data
@@ -612,7 +614,7 @@ class RunTest:
>>> modifiers_test.run_all_tests()
"""
- def __init__(self, tests, apply_modifiers=False):
+ def __init__(self, tests, apply_modifiers=False, do_compare=False):
"""
Construct a modifier test.
:param tests: list - list of modifier or operator test cases. Each element in the list must contain the
@@ -627,6 +629,7 @@ class RunTest:
self.tests = tests
self._check_for_unique_test_name()
self.apply_modifiers = apply_modifiers
+ self.do_compare = do_compare
self.verbose = os.environ.get("BLENDER_VERBOSE") is not None
self._failed_tests_list = []
@@ -697,6 +700,9 @@ class RunTest:
if self.apply_modifiers:
test.apply_modifier = True
+ if self.do_compare:
+ test.do_compare = True
+
success = test.run_test()
if test.is_test_updated():
# Run the test again if the blend file has been updated.
diff --git a/tests/python/operators.py b/tests/python/operators.py
index 80b470c3668..93cdfebab7b 100644
--- a/tests/python/operators.py
+++ b/tests/python/operators.py
@@ -207,11 +207,11 @@ def main():
command = list(sys.argv)
for i, cmd in enumerate(command):
if cmd == "--run-all-tests":
- operators_test.apply_modifiers = True
+ operators_test.do_compare = True
operators_test.run_all_tests()
break
elif cmd == "--run-test":
- operators_test.apply_modifiers = False
+ operators_test.do_compare = False
name = command[i + 1]
operators_test.run_test(name)
break
diff --git a/tests/python/physics_cloth.py b/tests/python/physics_cloth.py
index 700544262c2..c1af01be17d 100644
--- a/tests/python/physics_cloth.py
+++ b/tests/python/physics_cloth.py
@@ -53,10 +53,12 @@ def main():
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)
break
diff --git a/tests/python/physics_dynamic_paint.py b/tests/python/physics_dynamic_paint.py
index 45ab5551978..b5d09c8cb3a 100644
--- a/tests/python/physics_dynamic_paint.py
+++ b/tests/python/physics_dynamic_paint.py
@@ -43,10 +43,12 @@ def main():
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)
break
diff --git a/tests/python/physics_ocean.py b/tests/python/physics_ocean.py
index e569fea0074..40227d3d8d7 100644
--- a/tests/python/physics_ocean.py
+++ b/tests/python/physics_ocean.py
@@ -39,10 +39,12 @@ def main():
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)
break
diff --git a/tests/python/physics_particle_instance.py b/tests/python/physics_particle_instance.py
index e7f882eaaa5..aa18896b4d3 100644
--- a/tests/python/physics_particle_instance.py
+++ b/tests/python/physics_particle_instance.py
@@ -41,10 +41,12 @@ def main():
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 = str(command[i + 1])
particle_instance_test.run_test(name)
break
diff --git a/tests/python/physics_particle_system.py b/tests/python/physics_particle_system.py
index 0fc3e1ab622..0adc5ab1c54 100644
--- a/tests/python/physics_particle_system.py
+++ b/tests/python/physics_particle_system.py
@@ -40,10 +40,12 @@ def main():
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)
break
diff --git a/tes
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list