[Bf-blender-cvs] [f52c6749911] soc-2021-geometry-nodes-regression-test: Alerted ctest with failed or pass
Himanshi Kalra
noreply at git.blender.org
Thu Jun 17 07:46:17 CEST 2021
Commit: f52c6749911a3a485b111a965e423483ebe4a5f0
Author: Himanshi Kalra
Date: Wed Jun 16 13:51:05 2021 +0530
Branches: soc-2021-geometry-nodes-regression-test
https://developer.blender.org/rBf52c6749911a3a485b111a965e423483ebe4a5f0
Alerted ctest with failed or pass
Added a global file count base condition, in case of failure
recursion. Added exit condition for errors.
===================================================================
M tests/python/geo_node_test.py
===================================================================
diff --git a/tests/python/geo_node_test.py b/tests/python/geo_node_test.py
index 89bcc99bd92..974df477c07 100644
--- a/tests/python/geo_node_test.py
+++ b/tests/python/geo_node_test.py
@@ -129,7 +129,10 @@ def compare_meshes(evaluated_object, expected_object):
evaluated_data = evaluated_object.data
exp_data = expected_object.data
result = evaluated_data.unit_test_compare(mesh=exp_data)
- return result
+ if result == "Same":
+ print("\nPASSED")
+ else:
+ failed_test(evaluated_object, expected_object, result)
def failed_test(evaluated_object, expected_object, result):
@@ -138,12 +141,13 @@ def failed_test(evaluated_object, expected_object, result):
Updates the expected object on failure if BLENDER_TEST_UPDATE
environment variable is set.
"""
- print("FAIL with {}".format(result))
+ print("\nFAILED with {}".format(result))
update_test_flag = os.getenv('BLENDER_TEST_UPDATE') is not None
if not update_test_flag:
- return
+ sys.exit(1)
print("Updating the test...")
+ global FILE_UPDATE_COUNT
FILE_UPDATE_COUNT += 1
evaluated_object.location = expected_object.location
expected_object_name = expected_object.name
@@ -154,13 +158,14 @@ def failed_test(evaluated_object, expected_object, result):
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(
+ print("The blend file {} was updated.".format(
bpy.path.display_name_from_filepath(bpy.data.filepath)))
print("Re-running the test...")
if FILE_UPDATE_COUNT < 2:
main()
else:
- print("The script has run into some errors. Exiting...")
+ print("The script has run into some errors. Test cannot pass. Exiting...")
+ sys.exit(1)
def duplicate_test_object(test_object):
@@ -193,11 +198,7 @@ def main():
expected_object = get_expected_object()
evaluated_object = duplicate_test_object(test_object)
evaluated_object = apply_modifier(evaluated_object)
- result = compare_meshes(evaluated_object, expected_object)
- if result == "Same":
- print("PASS")
- else:
- failed_test(evaluated_object, expected_object, result)
+ compare_meshes(evaluated_object, expected_object)
if __name__ == "__main__":
More information about the Bf-blender-cvs
mailing list