11from importlib import resources
22
33import numpy
4- import parmed
54import pytest
65from openff .toolkit import ForceField , Molecule , Quantity , Topology , unit
76from openff .toolkit .typing .engines .smirnoff import VirtualSiteHandler
2524 import openmm .unit
2625
2726
27+ @skip_if_missing ("intermol" )
2828@skip_if_missing ("mdtraj" )
2929@skip_if_missing ("openmm" )
3030@needs_gmx
3131class TestGROMACSGROFile :
32- _INTERMOL_PATH = resources .files (
33- "intermol.tests.gromacs.unit_tests" ,
34- )
32+ try :
33+ _INTERMOL_PATH = resources .files (
34+ "intermol.tests.gromacs.unit_tests" ,
35+ )
36+ except ImportError :
37+ _INTERMOL_PATH = None
3538
3639 @skip_if_missing ("intermol" )
3740 def test_load_gro (self ):
@@ -54,6 +57,7 @@ def test_load_gro(self):
5457 assert numpy .allclose (box , openmm_box )
5558
5659 @skip_if_missing ("intermol" )
60+ @pytest .mark .skip ("don't run parmed tests" )
5761 def test_load_gro_nonstandard_precision (self ):
5862 file = self ._INTERMOL_PATH / "lj3_bulk/lj3_bulk.gro"
5963
@@ -126,8 +130,9 @@ def test_simple_roundtrip(self, sage, smiles, reader):
126130 },
127131 )
128132
129- @skip_if_missing ( " parmed" )
133+ @pytest . mark . skip ( "don't run parmed tests " )
130134 def test_num_impropers (self , sage ):
135+ parmed = pytest .importorskip ("parmed" )
131136 out = Interchange .from_smirnoff (
132137 sage ,
133138 MoleculeWithConformer .from_smiles ("CC1=CC=CC=C1" ).to_topology (),
@@ -174,12 +179,14 @@ def test_unsupported_mixing_rule(self, ethanol_top, sage):
174179 interchange .to_top ("out.top" )
175180
176181 @pytest .mark .slow
182+ @pytest .mark .skip ("don't run parmed tests" )
177183 @skip_if_missing ("openmm" )
178184 def test_residue_info (self , sage ):
179185 """Test that residue information is passed through to .top files."""
180- import parmed
181186 from openff .units .openmm import from_openmm
182187
188+ parmed = pytest .importorskip ("parmed" )
189+
183190 protein = get_protein ("MainChain_HIE" )
184191
185192 box_vectors = from_openmm (
@@ -272,6 +279,8 @@ def sage_with_monovalent_lone_pair(self, sage):
272279 @skip_if_missing ("parmed" )
273280 def test_sigma_hole_example (self , sage_with_sigma_hole ):
274281 """Test that a single-molecule sigma hole example runs"""
282+ parmed = pytest .importorskip ("parmed" )
283+
275284 molecule = MoleculeWithConformer .from_smiles ("CCl" , name = "Chloromethane" )
276285
277286 out = Interchange .from_smirnoff (
0 commit comments