[Bf-blender-cvs] [1942c8293e9] soc-2020-testing-frameworks: Fixing runtime error for operator tests, updating class names

calra123 noreply at git.blender.org
Fri Aug 21 17:21:31 CEST 2020


Commit: 1942c8293e93c9a025309309f08e542cbbe61c76
Author: calra123
Date:   Fri Aug 21 01:08:20 2020 +0530
Branches: soc-2020-testing-frameworks
https://developer.blender.org/rB1942c8293e93c9a025309309f08e542cbbe61c76

Fixing runtime error for operator tests, updating class names

===================================================================

M	tests/python/deform_modifiers.py
M	tests/python/modifiers.py
M	tests/python/modules/mesh_test.py
M	tests/python/operators.py

===================================================================

diff --git a/tests/python/deform_modifiers.py b/tests/python/deform_modifiers.py
index fdadbd86dc1..9c8b26f9678 100644
--- a/tests/python/deform_modifiers.py
+++ b/tests/python/deform_modifiers.py
@@ -28,7 +28,7 @@ import sys
 import bpy
 
 sys.path.append(os.path.dirname(os.path.realpath(__file__)))
-from modules.mesh_test import MeshTest, ModifierSpec, ObjectOperatorSpec, DeformModifierSpec, DeformModifierTest
+from modules.mesh_test import MeshTest, ModifierSpec, OperatorSpecObjectMode, DeformModifierSpec, DeformModifierTest
 
 tests = [
 
@@ -36,40 +36,39 @@ tests = [
     # Actual deformation occurs by animating imitating user input.
 
     MeshTest("SurfaceDeform", "testObjMonkeySurfaceDeform", "expObjMonkeySurfaceDeform",
-             [DeformModifierSpec(10, [ModifierSpec('surface_deform', 'SURFACE_DEFORM', {'target': bpy.data.objects["Cube"]})],
-              ObjectOperatorSpec('surfacedeform_bind', {'modifier': 'surface_deform'}))]),
+             [DeformModifierSpec(10, [
+                 ModifierSpec('surface_deform', 'SURFACE_DEFORM', {'target': bpy.data.objects["Cube"]})],
+                                 OperatorSpecObjectMode('surfacedeform_bind', {'modifier': 'surface_deform'}))]),
 
     # Mesh Deform Test, finally can bind to the Target object.
     # Actual deformation occurs by animating imitating user input.
 
     MeshTest("MeshDeform", "testObjMonkeyMeshDeform", "expObjMonkeyMeshDeform",
-             [DeformModifierSpec(10, [ModifierSpec('mesh_deform', 'MESH_DEFORM', {'object': bpy.data.objects["MeshCube"],
-                                                                                 'precision': 2})],
-                                 ObjectOperatorSpec('meshdeform_bind', {'modifier': 'mesh_deform'}))]),
-
+             [DeformModifierSpec(10, [ModifierSpec('mesh_deform', 'MESH_DEFORM',
+                                                   {'object': bpy.data.objects["MeshCube"], 'precision': 2})],
+                                 OperatorSpecObjectMode('meshdeform_bind', {'modifier': 'mesh_deform'}))]),
 
     # Surface Deform Test, finally can bind to the Target object.
     # Actual deformation occurs by animating imitating user input.
 
     MeshTest("Hook", "testObjHookPlane", "expObjHookPlane",
              [DeformModifierSpec(10, [ModifierSpec('hook', 'HOOK',
-                                                  {'object': bpy.data.objects["Empty"], 'falloff_radius': 1,
-                                                   'vertex_group': 'Group'})])]),
-
+                                                   {'object': bpy.data.objects["Empty"], 'falloff_radius': 1,
+                                                    'vertex_group': 'Group'})])]),
 
     # Laplacian Deform Test, first a hook is attached.
 
     MeshTest("Laplace", "testObjCubeLaplacian", "expObjCubeLaplacian",
              [DeformModifierSpec(10,
                                  [ModifierSpec('hook2', 'HOOK', {'object': bpy.data.objects["Empty.001"],
-                                                                'vertex_group': 'hook_vg'}),
-                                 ModifierSpec('laplace', 'LAPLACIANDEFORM', {'vertex_group': 'laplace_vg'})],
-                                 ObjectOperatorSpec('laplaciandeform_bind', {'modifier': 'laplace'}))]),
-
+                                                                 'vertex_group': 'hook_vg'}),
+                                  ModifierSpec('laplace', 'LAPLACIANDEFORM', {'vertex_group': 'laplace_vg'})],
+                                 OperatorSpecObjectMode('laplaciandeform_bind', {'modifier': 'laplace'}))]),
 
     MeshTest("WarpPlane", "testObjPlaneWarp", "expObjPlaneWarp",
              [DeformModifierSpec(10, [ModifierSpec('warp', 'WARP',
-                                                   {'object_from': bpy.data.objects["From"], 'object_to': bpy.data.objects["To"],
+                                                   {'object_from': bpy.data.objects["From"],
+                                                    'object_to': bpy.data.objects["To"],
                                                     })])]),
 
     #############################################
@@ -88,12 +87,14 @@ tests = [
     # here is no equivalent of a vertex group in Curves.
     # Dummy test for Hook, can also be called corner case
     MeshTest("CurveHook", "testObjBezierCurveHook", "expObjBezierCurveHook",
-             [DeformModifierSpec(10, [ModifierSpec('curve_Hook', 'HOOK', {'object': bpy.data.objects['EmptyCurve']})])]),
+             [DeformModifierSpec(10,
+                                 [ModifierSpec('curve_Hook', 'HOOK', {'object': bpy.data.objects['EmptyCurve']})])]),
 
     MeshTest("MeshDeformCurve", "testObjCurveMeshDeform", "expObjCurveMeshDeform",
-             [DeformModifierSpec(10, [ModifierSpec('mesh_deform_curve', 'MESH_DEFORM', {'object': bpy.data.objects["Cylinder"],
-                                                                                  'precision': 2})],
-                                 ObjectOperatorSpec('meshdeform_bind', {'modifier': 'mesh_deform_curve'}))]),
+             [DeformModifierSpec(10, [
+                 ModifierSpec('mesh_deform_curve', 'MESH_DEFORM', {'object': bpy.data.objects["Cylinder"],
+                                                                   'precision': 2})],
+                                 OperatorSpecObjectMode('meshdeform_bind', {'modifier': 'mesh_deform_curve'}))]),
 
     MeshTest("WarpCurve", "testObjBezierCurveWarp", "expObjBezierCurveWarp",
              [DeformModifierSpec(10, [ModifierSpec('warp_curve', 'WARP',
diff --git a/tests/python/modifiers.py b/tests/python/modifiers.py
index d5b4879e420..c0378e5457f 100644
--- a/tests/python/modifiers.py
+++ b/tests/python/modifiers.py
@@ -279,7 +279,7 @@ def main():
          [ModifierSpec('build', 'BUILD', {'frame_start': 0, 'frame_duration': 1})]],
 
         ["CurveDecimate", "testObjBezierCurveDecimate", "expObjBezierCurveDecimate",
-         [ModifierSpec('decimate', 'DECIMATE', {'ratio':0.5})]],
+         [ModifierSpec('decimate', 'DECIMATE', {'ratio': 0.5})]],
 
         ["CurveEdgeSplit", "testObjBezierCurveEdgeSplit", "expObjBezierCurveEdgeSplit",
          [ModifierSpec('edgeSplit', 'EDGE_SPLIT', {})]],
@@ -291,7 +291,7 @@ def main():
          [ModifierSpec('screw', 'SCREW', {})]],
 
         ["CurveSolidify", "testObjBezierCurveSolidify", "expObjBezierCurveSolidify",
-         [ModifierSpec('solidify', 'SOLIDIFY', {'thickness':1})]],
+         [ModifierSpec('solidify', 'SOLIDIFY', {'thickness': 1})]],
 
         ["CurveSubSurf", "testObjBezierCurveSubSurf", "expObjBezierCurveSubSurf",
          [ModifierSpec('subSurf', 'SUBSURF', {})]],
@@ -320,7 +320,6 @@ def main():
         ["CurveSimpleDeform", "testObjBezierCurveSimpleDeform", "expObjBezierCurveSimpleDeform",
          [ModifierSpec('simple_deform', 'SIMPLE_DEFORM', {'angle': math.radians(90)})]],
 
-
         ["CurveSmooth", "testObjBezierCurveSmooth", "expObjBezierCurveSmooth",
          [ModifierSpec('smooth', 'SMOOTH', {'factor': 10})]],
 
@@ -330,10 +329,6 @@ def main():
         ["CurveCurve", "testObjBezierCurveCurve", "expObjBezierCurveCurve",
          [ModifierSpec('curve_Curve', 'CURVE', {'object': bpy.data.objects['NurbsCurve']})]],
 
-
-
-
-
     ]
 
     modifiers_test = ModifierTest(tests)
diff --git a/tests/python/modules/mesh_test.py b/tests/python/modules/mesh_test.py
index 2e644a58f07..8fb65655b09 100644
--- a/tests/python/modules/mesh_test.py
+++ b/tests/python/modules/mesh_test.py
@@ -45,7 +45,6 @@ import functools
 import inspect
 import os
 
-
 # Output from this module and from blender itself will occur during tests.
 # We need to flush python so that the output is properly interleaved, otherwise
 # blender's output for one test will end up showing in the middle of another test...
@@ -147,6 +146,7 @@ class DeformModifierSpec:
     Holds a list of deform modifier and OperatorSpecObjectMode.
     For deform modifiers which have an object operator
     """
+
     def __init__(self, frame_number: int, modifier_list: list, object_operator_spec: OperatorSpecObjectMode = None):
         """
         Constructs a Deform Modifier spec (for user input)
@@ -169,16 +169,17 @@ class MeshTest:
     the public method run_test().
     """
 
-    def __init__(self, test_name: str, test_object_name: str, expected_object_name: str, operations_stack=None, apply_modifiers=False, threshold=None):
+    def __init__(self, test_name: str, test_object_name: str, expected_object_name: str, operations_stack=None,
+                 apply_modifiers=False, threshold=None):
         """
         Constructs a MeshTest object. Raises a KeyError if objects with names expected_object_name
         or test_object_name don't exist.
         :param test_name: str - unique test name identifier.
-        :param test_object: str - Name of object of mesh type to run the operations on.
-        :param expected_object: str - Name of object of mesh type that has the expected
+        :param test_object_name: str - Name of object of mesh type to run the operations on.
+        :param expected_object_name: str - Name of object of mesh type that has the expected
                                 geometry after running the operations.
         :param operations_stack: list - stack holding operations to perform on the test_object.
-        :param apply_modifier: bool - True if we want to apply the modifiers right after adding them to the object.
+        :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 threshold : exponent: To allow variations and accept difference to a certain degree.
@@ -294,7 +295,7 @@ class MeshTest:
                 try:
                     # We want to set the attribute only when we have reached the last setting
                     # Applying of intermediate settings is meaningless.
-                    if i == len(nested_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list