File size: 613 Bytes
b7e49b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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")))