Update addon tests, bootstrap runtime, download progress, and worker functionality

- 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.
This commit is contained in:
2026-08-07 13:11:04 +08:00
parent e0cb995473
commit d08d0e9c1a
17 changed files with 1799 additions and 262 deletions

View File

@@ -4,6 +4,7 @@ import secrets
import shutil
import socket
import subprocess
import sys
import time
import uuid
from dataclasses import dataclass
@@ -141,7 +142,13 @@ def uv_executable():
return resolved
if Path(configured).is_file():
return str(Path(configured))
raise RuntimeError("uv executable was not found")
return str(uv_cache_path())
def uv_cache_path():
if os.name == "nt":
return storage_root() / "uv" / "uv.exe"
return storage_root() / "uv" / "uv"
def install_runtime_command(status_path):
@@ -150,11 +157,7 @@ def install_runtime_command(status_path):
backend = getattr(addon_preferences, "torch_backend", "CU128")
script = Path(__file__).with_name("bootstrap_runtime.py")
return [
executable,
"run",
"--no-project",
"--python",
"3.12",
sys.executable,
str(script),
"--uv",
executable,
@@ -450,7 +453,8 @@ def detach_host_client():
pass
_host_connection = None
_registered_instance_id = None
_close_launched_host(terminate=False)
# 如果 Host 是由当前 Blender 启动的,关闭 Blender 时直接终止它,无需等待空闲超时
_close_launched_host(terminate=True)
def schedule_host_start():
@@ -598,6 +602,8 @@ def download_model_command(model_key, status_path):
str(model_directory(model_key)),
"--status",
str(status_path),
"--label",
model.label,
]
for pattern in model.download_patterns:
command.extend(["--allow-pattern", pattern])