-
Notifications
You must be signed in to change notification settings - Fork 73
/
conftest.py
86 lines (68 loc) · 2.53 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import pytest
import chainladder as cl
def pytest_generate_tests(metafunc):
if "raa" in metafunc.fixturenames:
metafunc.parametrize("raa", ["normal_run", "sparse_only_run"], indirect=True)
if "qtr" in metafunc.fixturenames:
metafunc.parametrize("qtr", ["normal_run", "sparse_only_run"], indirect=True)
if "clrd" in metafunc.fixturenames:
metafunc.parametrize("clrd", ["normal_run", "sparse_only_run"], indirect=True)
if "genins" in metafunc.fixturenames:
metafunc.parametrize("genins", ["normal_run", "sparse_only_run"], indirect=True)
if "prism_dense" in metafunc.fixturenames:
metafunc.parametrize(
"prism_dense", ["normal_run", "sparse_only_run"], indirect=True
)
if "prism" in metafunc.fixturenames:
metafunc.parametrize("prism", ["normal_run"], indirect=True)
if "xyz" in metafunc.fixturenames:
metafunc.parametrize("xyz", ["normal_run", "sparse_only_run"], indirect=True)
@pytest.fixture
def raa(request):
if request.param == "sparse_only_run":
cl.options.set_option("ARRAY_BACKEND", "sparse")
else:
cl.options.set_option("ARRAY_BACKEND", "numpy")
return cl.load_sample("raa")
@pytest.fixture
def qtr(request):
if request.param == "sparse_only_run":
cl.options.set_option("ARRAY_BACKEND", "sparse")
else:
cl.options.set_option("ARRAY_BACKEND", "numpy")
return cl.load_sample("quarterly")
@pytest.fixture
def clrd(request):
if request.param == "sparse_only_run":
cl.options.set_option("ARRAY_BACKEND", "sparse")
else:
cl.options.set_option("ARRAY_BACKEND", "numpy")
return cl.load_sample("clrd")
@pytest.fixture
def genins(request):
if request.param == "sparse_only_run":
cl.options.set_option("ARRAY_BACKEND", "sparse")
else:
cl.options.set_option("ARRAY_BACKEND", "numpy")
return cl.load_sample("genins")
@pytest.fixture
def prism(request):
cl.options.set_option("ARRAY_BACKEND", "numpy")
return cl.load_sample("prism")
@pytest.fixture
def prism_dense(request):
if request.param == "sparse_only_run":
cl.options.set_option("ARRAY_BACKEND", "sparse")
else:
cl.options.set_option("ARRAY_BACKEND", "numpy")
return cl.load_sample("prism").sum()
@pytest.fixture
def xyz(request):
if request.param == "sparse_only_run":
cl.options.set_option("ARRAY_BACKEND", "sparse")
else:
cl.options.set_option("ARRAY_BACKEND", "numpy")
return cl.load_sample("xyz")
@pytest.fixture
def atol():
return 1e-4