Skip to content

Commit 663a68d

Browse files
committed
remove other uses of simtk
1 parent 6d3f000 commit 663a68d

3 files changed

Lines changed: 40 additions & 6 deletions

File tree

‎paths_cli/tests/wizard/conftest.py‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,29 @@
33
import openpathsampling as paths
44
import mdtraj as md
55

6+
try:
7+
import openmm as mm
8+
from openmm import unit as u
9+
except ImportError:
10+
try:
11+
from simtk import openmm as mm
12+
from simtk import unit as u
13+
except ImportError:
14+
HAS_OPENMM = False
15+
else: # -no-cov-
16+
HAS_OPENMM = True
17+
else:
18+
HAS_OPENMM = True
19+
620
@pytest.fixture
721
def ad_openmm(tmpdir):
822
"""
923
Provide directory with files to start alanine depeptide sim in OpenMM
1024
"""
11-
mm = pytest.importorskip('simtk.openmm')
12-
u = pytest.importorskip('simtk.unit')
25+
if not HAS_OPENMM:
26+
pytest.skip()
27+
# mm = pytest.importorskip('simtk.openmm')
28+
# u = pytest.importorskip('simtk.unit')
1329
openmmtools = pytest.importorskip('openmmtools')
1430
md = pytest.importorskip('mdtraj')
1531
testsystem = openmmtools.testsystems.AlanineDipeptideVacuum()

‎paths_cli/tests/wizard/test_openmm.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,26 @@
88
_load_openmm_xml, _load_topology, openmm, OPENMM_SERIALIZATION_URL
99
)
1010

11+
try:
12+
import openmm as mm
13+
except ImportError:
14+
try:
15+
from simtk import openmm as mm
16+
except ImportError:
17+
HAS_OPENMM = False
18+
else:
19+
HAS_OPENMM = True # -no-cov-
20+
else:
21+
HAS_OPENMM = True
22+
1123
def test_helper_url():
1224
assert_url(OPENMM_SERIALIZATION_URL)
1325

1426
@pytest.mark.parametrize('obj_type', ['system', 'integrator', 'foo'])
1527
def test_load_openmm_xml(ad_openmm, obj_type):
16-
mm = pytest.importorskip('simtk.openmm')
28+
if not HAS_OPENMM:
29+
pytest.skip()
30+
# mm = pytest.importorskip("simtk.openmm")
1731
filename = f"{obj_type}.xml"
1832
inputs = [filename]
1933
expected_count = 1

‎paths_cli/wizard/openmm.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
from paths_cli.wizard.errors import FILE_LOADING_ERROR_MSG, not_installed
22
from paths_cli.wizard.core import get_object
33
try:
4-
from simtk import openmm as mm
5-
import mdtraj as md
4+
import openmm as mm
65
except ImportError:
7-
HAS_OPENMM = False
6+
try:
7+
from simtk import openmm as mm
8+
except ImportError:
9+
HAS_OPENMM = False
10+
else: # -no-cov-
11+
HAS_OPENMM = True
812
else:
913
HAS_OPENMM = True
1014

0 commit comments

Comments
 (0)