-
Notifications
You must be signed in to change notification settings - Fork 651
/
conftest.py
151 lines (105 loc) · 4 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import pytest
from MDAnalysis.analysis.base import AnalysisBase, AnalysisFromFunction
from MDAnalysisTests.analysis.test_base import (
FrameAnalysis,
IncompleteAnalysis,
OldAPIAnalysis,
)
from MDAnalysis.analysis.rms import RMSD, RMSF
from MDAnalysis.analysis.dihedrals import Dihedral, Ramachandran, Janin
from MDAnalysis.analysis.bat import BAT
from MDAnalysis.analysis.gnm import GNMAnalysis
from MDAnalysis.analysis.dssp.dssp import DSSP
from MDAnalysis.analysis.hydrogenbonds.hbond_analysis import (
HydrogenBondAnalysis,
)
from MDAnalysis.analysis.density import DensityAnalysis
from MDAnalysis.lib.util import is_installed
def params_for_cls(cls, exclude: list[str] = None):
"""
This part contains fixtures for simultaneous testing
of all available (=installed & supported) backends
for analysis subclasses.
If for some reason you want to limit backends,
simply pass "exclude: list[str]" to the function
that parametrizes fixture.
Parameters
----------
exclude : list[str], optional
list of backends to exclude from parametrization, by default None
Returns
-------
dict
dictionary with all tested keyword combinations for the run
"""
exclude = [] if exclude is None else exclude
possible_backends = cls.get_supported_backends()
installed_backends = [
b for b in possible_backends if is_installed(b) and b not in exclude
]
params = [
pytest.param({
"backend": backend,
"n_workers": nproc
}, ) for backend in installed_backends for nproc in (2, )
if backend != "serial"
]
params.extend([{"backend": "serial"}])
return params
@pytest.fixture(scope='module', params=params_for_cls(FrameAnalysis))
def client_FrameAnalysis(request):
return request.param
@pytest.fixture(scope='module', params=params_for_cls(AnalysisBase))
def client_AnalysisBase(request):
return request.param
@pytest.fixture(scope='module', params=params_for_cls(AnalysisFromFunction))
def client_AnalysisFromFunction(request):
return request.param
@pytest.fixture(scope='module',
params=params_for_cls(AnalysisFromFunction,
exclude=['multiprocessing']))
def client_AnalysisFromFunctionAnalysisClass(request):
return request.param
@pytest.fixture(scope='module', params=params_for_cls(IncompleteAnalysis))
def client_IncompleteAnalysis(request):
return request.param
@pytest.fixture(scope='module', params=params_for_cls(OldAPIAnalysis))
def client_OldAPIAnalysis(request):
return request.param
# MDAnalysis.analysis.rms
@pytest.fixture(scope='module', params=params_for_cls(RMSD))
def client_RMSD(request):
return request.param
@pytest.fixture(scope='module', params=params_for_cls(RMSF))
def client_RMSF(request):
return request.param
# MDAnalysis.analysis.dihedrals
@pytest.fixture(scope='module', params=params_for_cls(Dihedral))
def client_Dihedral(request):
return request.param
@pytest.fixture(scope='module', params=params_for_cls(Ramachandran))
def client_Ramachandran(request):
return request.param
@pytest.fixture(scope='module', params=params_for_cls(Janin))
def client_Janin(request):
return request.param
# MDAnalysis.analysis.gnm
@pytest.fixture(scope='module', params=params_for_cls(GNMAnalysis))
def client_GNMAnalysis(request):
return request.param
# MDAnalysis.analysis.bat
@pytest.fixture(scope='module', params=params_for_cls(BAT))
def client_BAT(request):
return request.param
# MDAnalysis.analysis.dssp.dssp
@pytest.fixture(scope="module", params=params_for_cls(DSSP))
def client_DSSP(request):
return request.param
# MDAnalysis.analysis.hydrogenbonds
@pytest.fixture(scope='module', params=params_for_cls(HydrogenBondAnalysis))
def client_HydrogenBondAnalysis(request):
return request.param
# MDAnalysis.analysis.density
@pytest.fixture(scope='module', params=params_for_cls(DensityAnalysis))
def client_DensityAnalysis(request):
return request.param