Files
AnyImage/tests/tools/test_environments.py
nan 2b3c0194a6
Some checks failed
Test / test (push) Failing after 46m18s
Add comprehensive tests for ONNX models and server jobs
- Introduced tests for the Moge3 ONNX model, including input validation, inference, and caching mechanisms.
- Added tests for ONNX runtime configurations and session management.
- Implemented tests for image upscaling functionality using ONNX models, ensuring proper handling of alpha channels and memory management.
- Created tests for panorama generation, verifying depth and visibility metrics.
- Developed tests for prediction artifacts, ensuring correct depth and normal data handling.
- Added server job tests for background removal and depth plane geometry generation, validating input handling and output correctness.
- Included environment tests to ensure proper dependency management and CI configurations.
2026-09-19 19:24:07 +08:00

57 lines
1.7 KiB
Python

import tomllib
from tests.support.paths import PROJECT_ROOT
def project_configuration():
return tomllib.loads(
(PROJECT_ROOT / "pyproject.toml").read_text(encoding="utf-8")
)
def group_packages(configuration, name):
groups = configuration["dependency-groups"]
packages = set()
for item in groups[name]:
if isinstance(item, dict):
packages.update(group_packages(configuration, item["include-group"]))
else:
packages.add(item.split("==", 1)[0].split(">=", 1)[0])
return packages
def test_capability_groups_keep_ci_dependencies_small():
configuration = project_configuration()
groups = configuration["dependency-groups"]
assert set(groups) == {"dev", "blender", "ai", "models", "docs"}
ci_packages = group_packages(configuration, "dev") | group_packages(
configuration, "blender"
)
assert ci_packages.isdisjoint(
{"huggingface-hub", "onnx", "onnxruntime", "torch"}
)
def test_ai_and_model_groups_own_their_runtime_dependencies():
configuration = project_configuration()
assert {"huggingface-hub", "onnxruntime"} <= group_packages(
configuration, "ai"
)
assert {"onnx", "onnxruntime", "torch"} <= group_packages(
configuration, "models"
)
def test_workflows_run_the_regular_blender_suite():
command = "uv run --group blender pytest tests/anyimage tests/tools"
for name in ("test.yml", "release.yml"):
workflow = (PROJECT_ROOT / ".github" / "workflows" / name).read_text(
encoding="utf-8"
)
assert command in workflow
release = (PROJECT_ROOT / ".github" / "workflows" / "release.yml").read_text(
encoding="utf-8"
)
assert "uv run pack" in release