From 60c60c79916d1258a030484933be65a846c20ef9 Mon Sep 17 00:00:00 2001 From: aryan02420 Date: Fri, 28 Mar 2025 20:39:22 +0530 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A7=AA=20test:=20add=20basic=20test?= =?UTF-8?q?=20infra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 11 ++++++++++- test/test-sanity.log.txt | 4 ++++ test/test-sanity.py | 9 +++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 test/test-sanity.log.txt create mode 100644 test/test-sanity.py diff --git a/Makefile b/Makefile index 78293c5..a5f6292 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ ADDON_NAME := $(shell cat ./bombsquad-tools/blender_manifest.toml | grep -oP '(?<=^id = \").*(?=\")') VERSION := $(shell cat ./bombsquad-tools/blender_manifest.toml | grep -oP '(?<=^version = \").*(?=\")') -.PHONY: dev tag publish CHANGELOG.md +.PHONY: dev test-all tag publish CHANGELOG.md all: $(ADDON_NAME)-$(VERSION).zip @@ -18,6 +18,15 @@ $(ADDON_NAME)-dev.zip: ./bombsquad-tools ./bombsquad-tools/** dev: find ./bombsquad-tools/ | entr -cs 'date --rfc-email; make $(ADDON_NAME)-dev.zip' +test-all: test/*.log.txt + git diff $^ + +test/%.log.txt: test/%.py $(ADDON_NAME)-dev.zip +# FIXME: set $BLENDER_USER_EXTENSIONS environment variable instead of installing the addon globally and polluting the user's file system + blender --command extension install-file -r user_default "$(realpath ./$(ADDON_NAME)-dev.zip)" +# The last 3 lines of output contain blender's build hash which adds un-necessary noise to the test snapshot + blender --background --factory-startup --addons bl_ext.user_default.$(ADDON_NAME) --debug-value 45623 --python "$(realpath $<)" | head -n -3 | tee $@ + clean: rm -rf *.zip diff --git a/test/test-sanity.log.txt b/test/test-sanity.log.txt new file mode 100644 index 0000000..fd65d16 --- /dev/null +++ b/test/test-sanity.log.txt @@ -0,0 +1,4 @@ +hello from blender +['Cube', 'Light', 'Camera'] +['Light', 'Camera'] +done diff --git a/test/test-sanity.py b/test/test-sanity.py new file mode 100644 index 0000000..58eed1e --- /dev/null +++ b/test/test-sanity.py @@ -0,0 +1,9 @@ +import bpy + +print("hello from blender") + +print([obj.name for obj in bpy.context.scene.collection.all_objects]) +bpy.ops.object.delete() +print([obj.name for obj in bpy.context.scene.collection.all_objects]) + +print("done") From b64fca5c32a6fe06a0083b98a38adc572ff3e850 Mon Sep 17 00:00:00 2001 From: aryan02420 Date: Sat, 29 Mar 2025 11:41:33 +0530 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9A=A8=20chore:=20remove=20unnecessar?= =?UTF-8?q?y=20warning=20on=20bpy.Props.XXX=20annotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bombsquad_tools.code-workspace | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bombsquad_tools.code-workspace b/bombsquad_tools.code-workspace index d007033..6827155 100644 --- a/bombsquad_tools.code-workspace +++ b/bombsquad_tools.code-workspace @@ -10,6 +10,10 @@ "./.venv/lib64/python3.11/site-packages", "./.venv/lib/python3.11/site-packages", ], + "python.analysis.diagnosticSeverityOverrides": { + // Disable warning "Call expression not allowed in type expression" on bpy.Props.XXX annotations + "reportInvalidTypeForm": "none", + }, }, "folders": [ {