Skip to content

Commit

Permalink
Merge pull request #85 from jchodera/debug
Browse files Browse the repository at this point in the history
Added test of common molecules to illustrate failures
  • Loading branch information
kyleabeauchamp committed Mar 22, 2015
2 parents 3488def + d46dc7b commit dd13c2a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions gaff2xml/tests/test_common_molecules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
Test some common molecules using OpenEye tools.
"""

import gaff2xml.openeye
from nose.plugins.attrib import attr
from unittest import skipIf
from gaff2xml import utils
import os

try:
oechem = utils.import_("openeye.oechem")
if not oechem.OEChemIsLicensed(): raise(ImportError("Need License for OEChem!"))
oequacpac = utils.import_("openeye.oequacpac")
if not oequacpac.OEQuacPacIsLicensed(): raise(ImportError("Need License for oequacpac!"))
oeiupac = utils.import_("openeye.oeiupac")
if not oeiupac.OEIUPACIsLicensed(): raise(ImportError("Need License for OEOmega!"))
oeomega = utils.import_("openeye.oeomega")
if not oeomega.OEOmegaIsLicensed(): raise(ImportError("Need License for OEOmega!"))
HAVE_OE = True
except:
HAVE_OE = False

molecules = [
'benzene',
'toluene',
'phenol',
'catechol',
'aspirin',
]

@skipIf(not HAVE_OE, "Cannot run test_common_molecules() module without OpenEye tools.")
def test_common_molecules():
import openeye.oechem
for molecule_name in molecules:
molecule = gaff2xml.openeye.iupac_to_oemol(molecule_name)
molecule = gaff2xml.openeye.get_charges(molecule)
with utils.enter_temp_directory():
tripos_mol2_filename = 'molecule.mol2'
molecule_name, tripos_mol2_filename = utils.molecule_to_mol2(molecule, tripos_mol2_filename=tripos_mol2_filename)
yield utils.tag_description(lambda : utils.test_molecule('molecule', tripos_mol2_filename), "Testing molecule %s" % molecule_name)

0 comments on commit dd13c2a

Please sign in to comment.