BMesh: Python: Add minimal API test for bmesh.

Hopefully will avoid critical failures like #140451 in the future.
This commit is contained in:
Bastien Montagne
2025-06-16 16:17:06 +02:00
parent c605c71a96
commit b6cccca661
2 changed files with 36 additions and 0 deletions

View File

@@ -261,6 +261,11 @@ add_blender_test(
--python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_text.py
)
add_blender_test(
script_pyapi_bmesh
--python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_bmesh.py
)
add_blender_test(
script_pyapi_grease_pencil
--python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_grease_pencil.py

View File

@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2025 Blender Authors
#
# SPDX-License-Identifier: Apache-2.0
# ./blender.bin --background --python tests/python/bl_pyapi_bmesh.py -- --verbose
import bmesh
import unittest
class TestBMeshBasic(unittest.TestCase):
def test_create_uvsphere(self):
bm = bmesh.new()
bmesh.ops.create_uvsphere(
bm,
u_segments=8,
v_segments=5,
radius=1.0,
)
self.assertEqual(len(bm.verts), 34)
self.assertEqual(len(bm.edges), 72)
self.assertEqual(len(bm.faces), 40)
bm.free()
if __name__ == "__main__":
import sys
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
unittest.main()