Files
AnyImage/tests/test_bootstrap_runtime.py
nan 9586b35440 Implement Omoo DA3 functionality with property group, runtime, worker, and status bar
- Added properties for Omoo DA3 settings in properties.py, including input path, video frames, model selection, and export format.
- Created runtime management in runtime.py, handling model downloads, job paths, and command execution for reconstruction.
- Developed status bar functionality in status_bar.py to display job progress and status.
- Implemented worker.py for image and video processing, including frame extraction and model inference.
- Added comprehensive unit tests covering addon registration, model handling, export processes, and UI interactions.
- Included a lock file for dependency management with uv.
2026-08-02 00:04:31 +08:00

64 lines
2.0 KiB
Python

import importlib.util
import tempfile
import unittest
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
PROJECT_ROOT = Path(__file__).resolve().parents[1]
def load_bootstrap_runtime():
specification = importlib.util.spec_from_file_location(
"omoo_da3_bootstrap_runtime",
PROJECT_ROOT / "src" / "omoo_da3" / "bootstrap_runtime.py",
)
module = importlib.util.module_from_spec(specification)
specification.loader.exec_module(module)
return module
class BootstrapRuntimeTest(unittest.TestCase):
def test_installs_da3_and_non_compiled_gsplat(self):
bootstrap = load_bootstrap_runtime()
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
runtime_dir = root / "runtime"
runtime_dir.mkdir()
args = SimpleNamespace(
uv="uv",
runtime_dir=str(runtime_dir),
backend="cu128",
da3_commit="test-commit",
status=str(root / "status.json"),
)
with patch.object(bootstrap, "run") as mocked_run:
bootstrap.install(args)
commands = [call.args[0] for call in mocked_run.call_args_list]
da3_command = next(
command
for command in commands
if any("depth-anything-3 @" in str(value) for value in command)
)
self.assertIn(
f"addict=={bootstrap.ADDICT_VERSION}",
da3_command,
)
gsplat_call = next(
call
for call in mocked_run.call_args_list
if any("gsplat @" in str(value) for value in call.args[0])
)
gsplat_command = gsplat_call.args[0]
self.assertIn("--no-build-isolation", gsplat_command)
self.assertTrue(
any(bootstrap.GSPLAT_COMMIT in str(value) for value in gsplat_command)
)
self.assertEqual(gsplat_call.args[1], {"BUILD_NO_CUDA": "1"})
if __name__ == "__main__":
unittest.main()