Update unit test template with last modifications, clean and manage some errors
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
MOUNT_FOLDER="addon_moderlab"
|
/opt/blender/blender --background --python-exit-code 1 --python "$FOLDER_TEST/tests/utils/blender_addon.py" || exit 1 > /dev/null 2>&1
|
||||||
export FOLDER_TEST=$MOUNT_FOLDER
|
|
||||||
/opt/blender/blender --background --python-exit-code 1 --python "/addon_moderlab/tests/utils/blender_addon.py" > /dev/null 2>&1 || exit 1
|
|
||||||
/opt/blender/blender --background -noaudio --disable-autoexec --python-exit-code 1 --python "$1" -- --verbose || exit 1
|
/opt/blender/blender --background -noaudio --disable-autoexec --python-exit-code 1 --python "$1" -- --verbose || exit 1
|
||||||
@@ -43,6 +43,5 @@ if __name__ == '__main__':
|
|||||||
launch_unit_test(test=test_list, tag=docker_tag)
|
launch_unit_test(test=test_list, tag=docker_tag)
|
||||||
|
|
||||||
# Clear archive file and container
|
# Clear archive file and container
|
||||||
clear_container_test(tag=docker_tag)
|
|
||||||
for archive in archives:
|
for archive in archives:
|
||||||
os.remove(Path(os.getcwd(), archive))
|
os.remove(Path(os.getcwd(), archive))
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import os
|
|||||||
class ActivateAddon(unittest.TestCase):
|
class ActivateAddon(unittest.TestCase):
|
||||||
"""Activate the Blender addon"""
|
"""Activate the Blender addon"""
|
||||||
|
|
||||||
def setUp(self) -> None:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_folder_name():
|
def get_folder_name():
|
||||||
"""Return the folder name to get the addon name we want activated"""
|
"""Return the folder name to get the addon name we want activated"""
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ def b3d_launch_blender_test(client: docker = docker.from_env(), test: list = Non
|
|||||||
try:
|
try:
|
||||||
for test in unit_test:
|
for test in unit_test:
|
||||||
print(f'Start this test : {test}')
|
print(f'Start this test : {test}')
|
||||||
command = [f"/bin/bash",
|
command = [f"/bin/sh",
|
||||||
f"{PurePosixPath(container_folder, 'tests', 'launch_test.sh')}",
|
f"{PurePosixPath(container_folder, 'tests', 'launch_test.sh')}",
|
||||||
f"{PurePosixPath(container_folder, 'tests', 'unit_test', test)}"]
|
f"{PurePosixPath(container_folder, 'tests', 'unit_test', test)}"]
|
||||||
|
|
||||||
docker_test = client.containers.run(image_name, command=command, volumes=volume, privileged=True,
|
docker_test = client.containers.run(image_name, command=command, volumes=volume, privileged=True,
|
||||||
detach=True)
|
environment=[f'FOLDER_TEST={container_folder}'], detach=True, name=test)
|
||||||
exit_docker = docker_test.wait()
|
exit_docker = docker_test.wait()
|
||||||
if exit_docker['StatusCode'] != 0:
|
if exit_docker['StatusCode'] != 0:
|
||||||
print(f'Container error "{exit_docker["StatusCode"]}".\n\t'
|
print(f'Container error "{exit_docker["StatusCode"]}".\n\t'
|
||||||
|
|||||||
@@ -1,20 +1,36 @@
|
|||||||
import sys
|
|
||||||
import bpy
|
import bpy
|
||||||
|
import os
|
||||||
|
import pathlib
|
||||||
|
|
||||||
# Paste this variable in the blender.py
|
# Paste this variable in the blender.py
|
||||||
dependency = {
|
dependency = {
|
||||||
# 'moderlab_plugin': ['moderlab_plugin.zip', 'Moderlab-Production/BlenderPlugin'],
|
# 'moderlab_plugin': ['moderlab_plugin.zip', 'Moderlab-Production/BlenderPlugin'],
|
||||||
'moderlab_type': ['moderlab_type.zip', 'Moderlab-Production/BlenderObjectType'],
|
# 'moderlab_type': ['moderlab_type.zip', 'Moderlab-Production/BlenderObjectType'],
|
||||||
# 'moderlab_pie': ['moderlab_pie.zip', 'Moderlab-Production/BlenderPieMenu'],
|
# 'moderlab_pie': ['moderlab_pie.zip', 'Moderlab-Production/BlenderPieMenu'],
|
||||||
# 'uv-packer': ['uv-packer.zip', 'Moderlab-Production/UvPacker'],
|
# 'uv-packer': ['uv-packer.zip', 'Moderlab-Production/UvPacker'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def b3d_install_addon():
|
def b3d_install_addon():
|
||||||
for key, value in dependency.items():
|
env_name = 'FOLDER_TEST'
|
||||||
bpy.ops.preferences.addon_install(filepath=f'/addon_moderlab/{value[0]}')
|
try:
|
||||||
bpy.ops.preferences.addon_enable(module=key)
|
if not os.environ.get(env_name):
|
||||||
bpy.ops.wm.save_userpref()
|
raise KeyError
|
||||||
|
env_path = pathlib.Path(os.environ[env_name])
|
||||||
|
if not env_path.exists():
|
||||||
|
raise FileNotFoundError
|
||||||
|
|
||||||
|
for key, value in dependency.items():
|
||||||
|
bpy.ops.preferences.addon_install(filepath=f'{env_path}/{value[0]}')
|
||||||
|
bpy.ops.preferences.addon_enable(module=key)
|
||||||
|
bpy.ops.wm.save_userpref()
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
print(f'Env. "{env_name}" doesn\'t exist')
|
||||||
|
exit(1)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('Wrong path to execute this Unit Test')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user