-
Notifications
You must be signed in to change notification settings - Fork 4
/
conftest.py
41 lines (31 loc) · 954 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
import sys
import pathlib
import pytest
import tensorflow as tf
from treeflow import DEFAULT_FLOAT_DTYPE_TF
from functools import partial
conftest_dir = pathlib.Path(__file__).parents[0]
sys.path.append(str(conftest_dir / "test" / "helpers"))
sys.path.append(str(conftest_dir / "test" / "fixtures"))
@pytest.fixture
def tensor_constant():
return partial(tf.constant, dtype=DEFAULT_FLOAT_DTYPE_TF)
pytest_plugins = [
"tree_fixtures",
"data_fixtures",
"ratio_fixtures",
"substitution_fixtures",
"cli_fixtures",
]
if os.getenv("_PYTEST_RAISE", "0") != "0":
# Stop pytest catching exceptions in debug run configuration
@pytest.hookimpl(tryfirst=True)
def pytest_exception_interact(call):
raise call.excinfo.value
@pytest.hookimpl(tryfirst=True)
def pytest_internalerror(excinfo):
raise excinfo.value
@pytest.fixture
def test_data_dir():
return pathlib.Path("test") / "data"