[Bf-blender-cvs] [16f76725136] soc-2021-geometry-nodes-regression-test: Removed extra files

Himanshi Kalra noreply at git.blender.org
Thu Jul 8 22:44:36 CEST 2021


Commit: 16f76725136a0ce9c9c00553341f0b6b303c8465
Author: Himanshi Kalra
Date:   Fri Jul 9 02:08:20 2021 +0530
Branches: soc-2021-geometry-nodes-regression-test
https://developer.blender.org/rB16f76725136a0ce9c9c00553341f0b6b303c8465

Removed extra files

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

D	tests/python/geo_node_test.py
D	tests/python/modules/base_mesh_test.py
D	tests/python/modules/mesh_test_prototype.py
D	tests/python/modules/spec_classes.py
D	tests/python/test_classes.py

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

diff --git a/tests/python/geo_node_test.py b/tests/python/geo_node_test.py
deleted file mode 100644
index a5f94fa4da7..00000000000
--- a/tests/python/geo_node_test.py
+++ /dev/null
@@ -1,193 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-
-# Script for running tests pre-loaded from a blend file.
-#
-# General Idea
-#
-# Load a blend file.
-# Select the object.
-# Apply the GN modifier on a duplicated object.
-# Compare the result.
-# If test pass, print("SUCCESS").
-# If test fail, print("FAIL").
-#    Update tests if BLENDER_TEST_UPDATE flag is set.
-# Display result of failed tests.
-#
-# Set the BLENDER_TEST_UPDATE env variable to update the expected object.
-#
-### RUN TEST COMMAND ###
-# blender -b path_to_blend_file --python path/to/geo_node_test.py
-
-import bpy
-import os
-import sys
-
-
-def get_test_object():
-    """
-    Get test object or raise Exception.
-    """
-    try:
-        test_object = bpy.data.objects["test_object"]
-        return test_object
-    except KeyError:
-        raise Exception("No test object found!")
-
-
-def get_expected_object():
-    """
-    Get expected object or raise Exception.
-    """
-    try:
-        expected_object = bpy.data.objects["expected_object"]
-        return expected_object
-    except KeyError:
-        raise Exception("No expected object found!")
-
-
-def get_evaluated_object(test_object):
-    evaluated_object = duplicate_test_object(test_object)
-    apply_modifier(evaluated_object)
-    return evaluated_object
-
-
-def select_only_object(any_object):
-    """
-    Select the given object and make it active object.
-    """
-    bpy.ops.object.select_all(action="DESELECT")
-    bpy.context.view_layer.objects.active = any_object
-    any_object.select_set(True)
-
-
-def create_expected_object(test_object):
-    """
-    Create expected object when run with BLENDER_TEST_UPDATE
-    """
-    try:
-        expected_object = bpy.data.objects["expected_object"]
-
-    except KeyError:
-        print("Creating an expected object...")
-        evaluated_object = get_evaluated_object(test_object)
-
-        # Setting evaluted_object to expected_object to create
-        # a new expected_object.
-        expected_object = evaluated_object
-        expected_object.name = "expected_object"
-
-        # Be careful with tests dealing with global coordinates.
-        expected_object.location = (0, 10, 0)
-
-        # Save file with the expected object.
-        bpy.ops.wm.save_as_mainfile(filepath=bpy.data.filepath)
-
-
-def apply_modifier(evaluated_object):
-    """
-    Apply all modifiers (Geometry Nodes for now) added to the current object [Discuss]
-    """
-    select_only_object(evaluated_object)
-
-    modifiers_list = evaluated_object.modifiers
-
-    if modifiers_list[0].type == "NODES":
-        bpy.ops.object.modifier_apply(modifier=modifiers_list[0].name)
-    else:
-        raise Exception("Modifier not of Geometry Nodes type")
-
-
-def compare_meshes(evaluated_object, expected_object):
-    """
-    Compares the meshes of evaluated and expected objects.
-    """
-    evaluated_data = evaluated_object.data
-    exp_data = expected_object.data
-    result = evaluated_data.unit_test_compare(mesh=exp_data)
-    if result == "Same":
-        print("\nPASSED")
-    else:
-        failed_test(evaluated_object, expected_object, result)
-
-
-def failed_test(evaluated_object, expected_object, result):
-    """
-    Prints the failed test.
-    Updates the expected object on failure if BLENDER_TEST_UPDATE
-    environment variable is set.
-    """
-    print("\nFAILED with {}".format(result))
-    update_test_flag = os.getenv('BLENDER_TEST_UPDATE') is not None
-    if not update_test_flag:
-        sys.exit(1)
-
-    update_expected_object(evaluated_object, expected_object)
-    print("Re-running the test...")
-    run_test()
-
-
-def update_expected_object(evaluated_object, expected_object):
-    print("Updating the test...")
-    evaluated_object.location = expected_object.location
-    expected_object_name = expected_object.name
-    bpy.data.objects.remove(expected_object, do_unlink=True)
-    evaluated_object.name = expected_object_name
-
-    # Save file.
-    bpy.ops.wm.save_as_mainfile(filepath=bpy.data.filepath)
-
-    print("The test file was updated with new expected object")
-    print("The blend file {} was updated.".format(
-        bpy.path.display_name_from_filepath(bpy.data.filepath)))
-
-
-def duplicate_test_object(test_object):
-    """
-    Duplicate test object.
-    """
-    select_only_object(test_object)
-    bpy.ops.object.duplicate()
-    evaluated_object = bpy.context.active_object
-    evaluated_object.name = "evaluated_object"
-    return evaluated_object
-
-
-def run_test():
-    test_object = get_test_object()
-    expected_object = get_expected_object()
-    evaluated_object = get_evaluated_object(test_object)
-    compare_meshes(evaluated_object, expected_object)
-
-
-def main():
-    """
-    Main function controlling the workflow and running the tests.
-    """
-    test_object = get_test_object()
-    update_test_flag = os.getenv('BLENDER_TEST_UPDATE') is not None
-    if update_test_flag:
-        create_expected_object(test_object)
-    run_test()
-
-
-if __name__ == "__main__":
-    main()
diff --git a/tests/python/modules/base_mesh_test.py b/tests/python/modules/base_mesh_test.py
deleted file mode 100644
index 7d0f16eeb04..00000000000
--- a/tests/python/modules/base_mesh_test.py
+++ /dev/null
@@ -1,754 +0,0 @@
-from abc import ABC, abstractmethod
-import bpy
-import os
-import sys
-import inspect
-
-
-class ModifierSpec:
-    """
-    Holds a Generate or Deform or Physics modifier type and its parameters.
-    """
-
-    def __init__(self, modifier_name: str, modifier_type: str, modifier_parameters: dict, frame_end=0):
-        """
-        Constructs a modifier spec.
-        :param modifier_name: str - name of object modifier, e.g. "myFirstSubsurfModif"
-        :param modifier_type: str - type of object modifier, e.g. "SUBSURF"
-        :param modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"quality" : 4}
-        :param frame_end: int - frame at which simulation needs to be baked or modifier needs to be applied.
-        """
-        self.modifier_name = modifier_name
-        self.modifier_type = modifier_type
-        self.modifier_parameters = modifier_parameters
-        self.frame_end = frame_end
-
-    def __str__(self):
-        return "Modifier: " + self.modifier_name + " of type " + self.modifier_type + \
-               " with parameters: " + str(self.modifier_parameters)
-
-
-class ParticleSystemSpec:
-    """
-    Holds a Particle System modifier and its parameters.
-    """
-
-    def __init__(self, modifier_name: str, modifier_type: str, modifier_parameters: dict, frame_end: int):
-        """
-        Constructs a particle system spec.
-        :param modifier_name: str - name of object modifier, e.g. "Particles"
-        :param modifier_type: str - type of object modifier, e.g. "PARTICLE_SYSTEM"
-        :param modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"seed" : 1}
-        :param frame_end: int - the last frame of the simulation at which the modifier is applied
-        """
-        self.modifier_name = modifier_name
-        self.modifier_type = modifier_type
-        self.modifier_parameters = modifier_parameters
-        self.frame_end = frame_end
-
-    def __str__(self):
-        return "Physics Modifier: " + self.modifier_name + " of type " + self.modifier_type + \
-               " with parameters: " + \
-            str(self.modifier_parameters) + \
-            " with frame end: " + str(self.frame_end)
-
-
-class OperatorSpecEditMode:
-    """
-    Holds one operator and its parameters.
-    """
-
-    def __init__(self, operator_name: str, operator_parameters: dict, select_mode: str, selection: set):
-        """
-        Constructs an OperatorSpecEditMode. Raises ValueError if selec_mode is invalid.
-        :param operator_name: str - name of mesh operator from bpy.ops.mesh, e.g. "bevel" or "fill"
-        :param operator_parameters: dict - {name : val} dictionary containing operator parameters.
-        :param select_mode: str - mesh selection mode, must be either 'VERT', 'EDGE' or 'FACE'
-        :param selection: set - set of vertices/edges/faces indices to select, e.g. [0, 9, 10].
-        """
-        self.operator_name = operator_name
-        self.operator_parameters = operator_parameters
-        if select_mode not in ['VERT', 'EDGE', 'FACE']:
-            raise ValueError("select_mode must be either {}, {} or {}".format(
-                'VERT', 'EDGE', 'FACE'))
-        self.select_mode = select_mode
-        self.selection = selection
-
-    def __str__(self):
-        return "Operator: " + self.operator_name + " with parameters: " + str(self.operator_parameters) + \
-               " in selection mode: " + self.select_mode + \
-            ", selecting " + str(self.selection)
-
-
-class OperatorSpecObjectMode:
-    """
-    Holds an object operator and its parameters. Helper class for DeformModifierSpec.
-    Needed to support operations in Object Mode and not Edit Mode which is supported by OperatorSpecEditMode.
-    """
-
-    def __init__(self, operator_name: str, operator_parameters: dict):
-        """
-        :param operator_name: str - n

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list