DepthPro2 / code /tt_depthpro2 /tests /conftest.py
changh95's picture
tt-model push depthpro2 (container)
b7e49b8 verified
Raw History Blame Contribute Delete
613 Bytes
# SPDX-License-Identifier: Apache-2.0
"""Fixtures of the DepthPro2 tests (host and device). The package root (``code/``) is put on ``sys.path``; the host
tests' torch thread count is ``DEPTHPRO2_TEST_THREADS`` (default 8)."""
import os
import sys
import pytest
CODE = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if CODE not in sys.path:
sys.path.insert(0, CODE)
@pytest.fixture(scope="session", autouse=True)
def _threads():
try:
import torch
except ImportError:
return
torch.set_num_threads(int(os.environ.get("DEPTHPRO2_TEST_THREADS", "8")))