- Modified status messages and stage labels in `test_addon.py` for clarity and consistency. - Added tests to ensure proper host termination and command execution in `test_addon.py`. - Enhanced `test_bootstrap_runtime.py` with additional tests for installation behavior, including handling of CUDA and MPS devices, and improved error handling for disk space and network checks. - Updated download progress reporting in `test_download_progress.py` to include download speed and improved message formatting. - Added new tests in `test_worker.py` for device selection, NPZ file validation, and model downloading behavior with Hugging Face endpoints. - Bumped version in `uv.lock` to 0.9.30.
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
import importlib.util
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
from zipfile import ZipFile
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def load_pack():
|
|
specification = importlib.util.spec_from_file_location(
|
|
"snapform_pack",
|
|
PROJECT_ROOT / "pack.py",
|
|
)
|
|
module = importlib.util.module_from_spec(specification)
|
|
specification.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
class PackTest(unittest.TestCase):
|
|
def test_builds_extension_root_layout(self):
|
|
pack = load_pack()
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
original_dist = pack.DIST_DIR
|
|
pack.DIST_DIR = Path(directory)
|
|
try:
|
|
output_path = pack.build_extension()
|
|
finally:
|
|
pack.DIST_DIR = original_dist
|
|
|
|
self.assertEqual(output_path.name, "SnapForm.v0.9.32.zip")
|
|
with ZipFile(output_path) as archive:
|
|
names = set(archive.namelist())
|
|
|
|
self.assertIn("__init__.py", names)
|
|
self.assertIn("blender_manifest.toml", names)
|
|
self.assertIn("image_depth.py", names)
|
|
self.assertNotIn("snapform_depth_plane.py", names)
|
|
self.assertIn("worker.py", names)
|
|
self.assertIn("ai_host.py", names)
|
|
self.assertNotIn("importer.py", names)
|
|
self.assertNotIn("snapform/__init__.py", names)
|