|
8 | 8 | from unittest.mock import patch |
9 | 9 |
|
10 | 10 | import numpy as np |
11 | | -import open3d as o3d |
12 | 11 | import pytest |
13 | 12 | import torch |
14 | | -import trimesh |
15 | 13 | from fastapi.testclient import TestClient |
16 | 14 | from PIL import Image |
17 | 15 |
|
18 | | -from vizion3d.proto import lifting_pb2 |
19 | | -from vizion3d.reconstruction import ( |
20 | | - Object3DReconstructionCommand, |
21 | | - Object3DReconstructionConfig, |
22 | | - Object3DReconstructionResult, |
23 | | - SceneComponents3DReconstructionCommand, |
24 | | - SceneComponents3DReconstructionConfig, |
25 | | -) |
26 | | -from vizion3d.reconstruction.defaults import extract_model_bundle |
27 | | -from vizion3d.reconstruction.handlers import ( |
28 | | - Object3DReconstructionHandler, |
29 | | - SceneComponents3DReconstructionHandler, |
30 | | - _rembg_providers, |
31 | | -) |
32 | | -from vizion3d.server.grpc.server import LiftingServiceServicer |
33 | | -from vizion3d.server.rest.app import create_app |
| 16 | +try: |
| 17 | + import open3d as o3d |
| 18 | + import trimesh |
| 19 | + |
| 20 | + from vizion3d.proto import lifting_pb2 |
| 21 | + from vizion3d.reconstruction import ( |
| 22 | + Object3DReconstructionCommand, |
| 23 | + Object3DReconstructionConfig, |
| 24 | + Object3DReconstructionResult, |
| 25 | + SceneComponents3DReconstructionCommand, |
| 26 | + SceneComponents3DReconstructionConfig, |
| 27 | + ) |
| 28 | + from vizion3d.reconstruction.defaults import extract_model_bundle |
| 29 | + from vizion3d.reconstruction.handlers import ( |
| 30 | + Object3DReconstructionHandler, |
| 31 | + SceneComponents3DReconstructionHandler, |
| 32 | + _rembg_providers, |
| 33 | + ) |
| 34 | + from vizion3d.server.grpc.server import LiftingServiceServicer |
| 35 | + from vizion3d.server.rest.app import create_app |
| 36 | +except ModuleNotFoundError as exc: |
| 37 | + optional_modules = {"open3d", "trimesh"} |
| 38 | + if exc.name in optional_modules: |
| 39 | + pytest.skip(f"{exc.name} is required for reconstruction tests", allow_module_level=True) |
| 40 | + raise |
34 | 41 |
|
35 | 42 |
|
36 | 43 | def _image_bytes(size=(64, 64), mode="RGBA") -> bytes: |
|
0 commit comments