- Implement sync_models.py for preparing and uploading ONNX artifacts. - Create build_node.py for building and validating Blender scripts. - Add docs.py for building and previewing documentation with Mike or MkDocs. - Introduce model_exports.py for exporting PyTorch models to ONNX format. - Develop pack.py for packaging the project with dependencies for different platforms. - Add test_sync_models.py to validate sync_models functionality. - Add test_tool_commands.py to ensure repository tools have correct command scripts. - Initialize tools package with __init__.py.
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
SOURCE_ROOT = PROJECT_ROOT / "src" / "anyimage"
|
|
|
|
|
|
class NodeAssetsTest(unittest.TestCase):
|
|
def test_production_code_does_not_create_node_groups(self):
|
|
offenders = []
|
|
for path in SOURCE_ROOT.rglob("*.py"):
|
|
if "bpy.data.node_groups.new" in path.read_text(encoding="utf-8"):
|
|
offenders.append(path.relative_to(PROJECT_ROOT).as_posix())
|
|
self.assertEqual(offenders, [])
|
|
|
|
def test_runtime_node_group_entries_load_assets(self):
|
|
object_source = (
|
|
SOURCE_ROOT / "common" / "object.py"
|
|
).read_text(encoding="utf-8")
|
|
mesh_plane_source = (
|
|
SOURCE_ROOT / "operators" / "convert_to_plane" / "mesh_plane.py"
|
|
).read_text(encoding="utf-8")
|
|
depth_plane_source = (
|
|
SOURCE_ROOT / "operators" / "convert_to_plane" / "object.py"
|
|
).read_text(encoding="utf-8")
|
|
self.assertIn("return load_node_group(group_name)", object_source)
|
|
self.assertIn(
|
|
"load_node_group(MESH_PLANE_NODE_GROUP_NAME)",
|
|
mesh_plane_source,
|
|
)
|
|
self.assertIn(
|
|
"load_node_group(DEPTH_PLANE_NODE_GROUP_NAME)",
|
|
depth_plane_source,
|
|
)
|
|
self.assertFalse(
|
|
(SOURCE_ROOT / "operators" / "convert_to_plane" / "nodes.py").exists()
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|