File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import openpathsampling as paths
44import mdtraj as md
55
6+ # should be able to remove this try block when we drop OpenMM < 7.6
7+ try :
8+ import openmm as mm
9+ from openmm import unit as u
10+ except ImportError :
11+ try :
12+ from simtk import openmm as mm
13+ from simtk import unit as u
14+ except ImportError :
15+ HAS_OPENMM = False
16+ else : # -no-cov-
17+ HAS_OPENMM = True
18+ else :
19+ HAS_OPENMM = True
20+
621@pytest .fixture
722def ad_openmm (tmpdir ):
823 """
924 Provide directory with files to start alanine depeptide sim in OpenMM
1025 """
11- mm = pytest .importorskip ('simtk.openmm' )
12- u = pytest .importorskip ('simtk.unit' )
26+ # switch back to importorskip when we drop OpenMM < 7.6
27+ if not HAS_OPENMM :
28+ pytest .skip ("could not import openmm" )
29+ # mm = pytest.importorskip('simtk.openmm')
30+ # u = pytest.importorskip('simtk.unit')
1331 openmmtools = pytest .importorskip ('openmmtools' )
1432 md = pytest .importorskip ('mdtraj' )
1533 testsystem = openmmtools .testsystems .AlanineDipeptideVacuum ()
Original file line number Diff line number Diff line change 88 _load_openmm_xml , _load_topology , openmm , OPENMM_SERIALIZATION_URL
99)
1010
11+ # should be able to remove this try block when we drop OpenMM < 7.6
12+ try :
13+ import openmm as mm
14+ except ImportError :
15+ try :
16+ from simtk import openmm as mm
17+ except ImportError :
18+ HAS_OPENMM = False
19+ else :
20+ HAS_OPENMM = True # -no-cov-
21+ else :
22+ HAS_OPENMM = True
23+
1124def test_helper_url ():
1225 assert_url (OPENMM_SERIALIZATION_URL )
1326
1427@pytest .mark .parametrize ('obj_type' , ['system' , 'integrator' , 'foo' ])
1528def test_load_openmm_xml (ad_openmm , obj_type ):
16- mm = pytest .importorskip ('simtk.openmm' )
29+ # switch back to importorskip when we drop OpenMM < 7.6
30+ if not HAS_OPENMM :
31+ pytest .skip ("could not import openmm" )
32+ # mm = pytest.importorskip("simtk.openmm")
1733 filename = f"{ obj_type } .xml"
1834 inputs = [filename ]
1935 expected_count = 1
Original file line number Diff line number Diff line change 11from paths_cli .wizard .errors import FILE_LOADING_ERROR_MSG , not_installed
22from paths_cli .wizard .core import get_object
3+
4+ # should be able to simplify this try block when we drop OpenMM < 7.6
35try :
4- from simtk import openmm as mm
5- import mdtraj as md
6+ import openmm as mm
67except ImportError :
7- HAS_OPENMM = False
8+ try :
9+ from simtk import openmm as mm
10+ except ImportError :
11+ HAS_OPENMM = False
12+ else : # -no-cov-
13+ HAS_OPENMM = True
814else :
915 HAS_OPENMM = True
1016
1117OPENMM_SERIALIZATION_URL = (
1218 "http://docs.openmm.org/latest/api-python/generated/"
13- "simtk. openmm.openmm.XmlSerializer.html"
19+ "openmm.openmm.XmlSerializer.html"
1420)
1521
1622def _openmm_serialization_helper (wizard , user_input ): # no-cov
You can’t perform that action at this time.
0 commit comments