-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathconftest.py
More file actions
275 lines (180 loc) · 6.39 KB
/
conftest.py
File metadata and controls
275 lines (180 loc) · 6.39 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
import pytest
import sire as sr
def pytest_addoption(parser):
parser.addoption(
"--runslow", action="store_true", default=False, help="run slow tests"
)
parser.addoption(
"--runveryslow",
action="store_true",
default=False,
help="run slow and veryslow tests",
)
def pytest_configure(config):
config.addinivalue_line(
"markers",
"slow: mark tests as slow to run (takes more than a couple of seconds",
)
config.addinivalue_line(
"markers",
"veryslow: mark tests as veryslow to run (takes more than 5-10 seconds to run",
)
def pytest_collection_modifyitems(config, items):
runslow = False
runveryslow = False
if config.getoption("--runslow"):
runslow = True
if config.getoption("--runveryslow"):
runslow = True
runveryslow = True
if not runslow:
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)
if not runveryslow:
skip_veryslow = pytest.mark.skip(reason="need --runveryslow option to run")
for item in items:
if "veryslow" in item.keywords:
item.add_marker(skip_veryslow)
@pytest.fixture(scope="session")
def ala_mols():
return sr.load_test_files("ala.top", "ala.crd")
@pytest.fixture(scope="session")
def ose_mols():
return sr.load_test_files("ose.top", "ose.crd")
@pytest.fixture(scope="session")
def zan_mols():
return sr.load_test_files("zan.top", "zan.rst")
@pytest.fixture(scope="session")
def h7n9_mols():
return sr.load_test_files("h7n9.pdb", "h7n9.dcd")
@pytest.fixture(scope="session")
def chol_mols():
return sr.load_test_files("cholesterol.sdf")
@pytest.fixture(scope="session")
def ala_traj():
return sr.load_test_files("ala.top", "ala.traj")
@pytest.fixture(scope="session")
def ala_trr():
return sr.load_test_files("ala.top", "ala.trr")
@pytest.fixture(scope="session")
def p38_mols():
return sr.load_test_files("p38.pdb")
@pytest.fixture(scope="session")
def alanin_mols():
return sr.load_test_files("alanin.psf")
@pytest.fixture(scope="session")
def kigaki_mols():
return sr.load_test_files("kigaki.gro", "kigaki.top")
@pytest.fixture(scope="session")
def neura_mols():
return sr.load_test_files("proteinbox.crd", "proteinbox.top")
@pytest.fixture(scope="session")
def excluded_mols():
return sr.load_test_files("excluded.rst7", "excluded.prm7")
@pytest.fixture(scope="session")
def wrapped_mols():
return sr.load_test_files("wrapped.rst7", "wrapped.prm7")
@pytest.fixture(scope="session")
def openmm_interchange_mols():
return sr.load_test_files("openmm_interchange.rst7", "openmm_interchange.prm7")
@pytest.fixture(scope="session")
def triclinic_protein():
return sr.load_test_files("triclinic_protein.prm7", "triclinic_protein.crd")
@pytest.fixture(scope="session")
def triclinic_protein_rst7():
return sr.load_test_files("triclinic_protein.prm7", "triclinic_protein.rst")
@pytest.fixture(scope="session")
def merged_ethane_methanol():
return sr.load_test_files("merged_molecule.s3")
@pytest.fixture(scope="session")
def merged_ethane_methane():
return sr.load_test_files("ethane_methane.bss")
@pytest.fixture(scope="session")
def merged_zan_ose():
return sr.load_test_files("merged_ligand.s3")
@pytest.fixture(scope="session")
def ethane_12dichloroethane():
return sr.load_test_files("ethane_12dichloroethane.bss")
@pytest.fixture(scope="session")
def cyclopentane_cyclohexane():
return sr.load_test_files("cyclopentane_cyclohexane.bss")
@pytest.fixture(scope="session")
def propane_cyclopropane():
return sr.load_test_files("propane_cyclopropane.bss")
@pytest.fixture(scope="session")
def pentane_cyclopentane():
return sr.load_test_files("pentane_cyclopentane.bss")
@pytest.fixture(scope="session")
def reordered_protein():
return sr.load_test_files("reordered_protein.top", "reordered_protein.crd")
@pytest.fixture(scope="session")
def pdb_3nss():
return sr.load_test_files("3NSS.pdb")
@pytest.fixture(scope="session")
def pdbx_3nss():
if "gemmi" in sr.convert.supported_formats():
return sr.load_test_files("3NSS.cif")
else:
return None
@pytest.fixture(scope="session")
def ejm55_sdf():
return sr.load_test_files("ejm55.sdf")
@pytest.fixture(scope="session")
def ejm55_gro():
return sr.load_test_files("ejm55.gro", "ejm55.top")
@pytest.fixture(scope="session")
def testfile_cache_dir():
import os
d = os.path.abspath(os.path.curdir)
if d.endswith("tests"):
# we are running in the tests directory, so cache downloads here
cache_dir = os.path.join(d, "cache")
else:
d2 = os.path.split(d)[0]
if d2.endswith("tests"):
# we are a subdirectory of the parent directory
cache_dir = os.path.join(d2, "cache")
else:
cache_dir = os.path.join(d, "cache")
return cache_dir
@pytest.fixture(scope="session")
def apo_1264():
return sr.load_test_files("apo_1264.prm7", "apo_1264.rst7")
@pytest.fixture(scope="session")
def neopentane_methane():
return sr.load_test_files("neo_meth_scratch.bss")
@pytest.fixture(scope="session")
def solvated_neopentane_methane():
return sr.load_test_files("neo_meth_solv.bss")
@pytest.fixture(scope="session")
def zero_lj_mols():
return sr.load_test_files("zero_lj.prm7", "zero_lj.rst7")
@pytest.fixture(scope="session")
def openmm_platform():
if "openmm" not in sr.convert.supported_formats():
return None
mols = sr.load_test_files("ala.top", "ala.crd")
for platform in ["CUDA", "OpenCL", "CPU"]:
try:
mols.dynamics(platform=platform)
return platform
except Exception:
pass
return "Reference"
@pytest.fixture(scope="session")
def thrombin_complex():
return sr.load_test_files("thrombin.top", "thrombin.rst7")
@pytest.fixture(scope="session")
def amber_cmap():
return sr.load_test_files("amber_cmap.prm7")
@pytest.fixture(scope="session")
def multichain_cmap():
return sr.load_test_files("multichain_cmap.prm7", "multichain_cmap.rst7")
@pytest.fixture(scope="session")
def gromacs_cmap():
return sr.load_test_files("1aki.gro", "1aki.top")
@pytest.fixture(scope="session")
def tagged_sdf():
return sr.load_test_files("sdf_tags.sdf")[0]