Add Chromium-only Blender WebEngine parity work
This commit is contained in:
25
blender-5.2.0/tests/blender_as_python_module/CMakeLists.txt
Normal file
25
blender-5.2.0/tests/blender_as_python_module/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
# SPDX-FileCopyrightText: 2021 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
function(add_blender_as_python_module_test testname testscript)
|
||||
if(NOT TEST_PYTHON_EXE)
|
||||
message(FATAL_ERROR "No Python configured for running tests, set TEST_PYTHON_EXE.")
|
||||
endif()
|
||||
|
||||
add_test(
|
||||
NAME ${testname}
|
||||
COMMAND ${TEST_PYTHON_EXE} ${TEST_PYTHON_EXE_EXTRA_ARGS} ${CMAKE_CURRENT_LIST_DIR}/${testscript} ${ARGN}
|
||||
)
|
||||
|
||||
# On macOS, asan library must be loaded early.
|
||||
if(APPLE AND WITH_COMPILER_ASAN)
|
||||
set_tests_properties(
|
||||
${testname}
|
||||
PROPERTIES ENVIRONMENT DYLD_INSERT_LIBRARIES=${COMPILER_ASAN_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
add_blender_as_python_module_test(import_bpy import_bpy.py ${CMAKE_INSTALL_PREFIX_WITH_CONFIG})
|
||||
add_blender_as_python_module_test(cleanup_bpy cleanup_bpy.py ${CMAKE_INSTALL_PREFIX_WITH_CONFIG})
|
||||
23
blender-5.2.0/tests/blender_as_python_module/cleanup_bpy.py
Normal file
23
blender-5.2.0/tests/blender_as_python_module/cleanup_bpy.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# SPDX-FileCopyrightText: 2025 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Add directory with module to the path.
|
||||
import sys
|
||||
sys.path.append(sys.argv[1])
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def _update_handler(self, context):
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
# This used to cause a memory leak and crash due to missing `bpy/__init__.so` cleanup,
|
||||
# something that CPython doesn't guarantee. See #148959.
|
||||
bpy.types.Object.custom_property = bpy.props.FloatProperty(update=_update_handler)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
25
blender-5.2.0/tests/blender_as_python_module/import_bpy.py
Normal file
25
blender-5.2.0/tests/blender_as_python_module/import_bpy.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# SPDX-FileCopyrightText: 2002-2022 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Add directory with module to the path.
|
||||
import sys
|
||||
sys.path.append(sys.argv[1])
|
||||
|
||||
# Just import `bpy` and see if there are any dynamic loader errors.
|
||||
import bpy
|
||||
|
||||
# Try bundled libraries.
|
||||
bpy.utils.expose_bundled_modules()
|
||||
|
||||
from pxr import Usd
|
||||
import MaterialX
|
||||
import OpenImageIO
|
||||
import PyOpenColorIO
|
||||
|
||||
# Test both old and new names, remove when all 4.4 libs have landed.
|
||||
try:
|
||||
import pyopenvdb
|
||||
except ModuleNotFoundError:
|
||||
import openvdb
|
||||
import oslquery
|
||||
Reference in New Issue
Block a user