Commit a3476d23 authored by peastman's avatar peastman
Browse files

Merge pull request #1086 from rmcgibbo/py3

Fix two tests for python3
parents c2891265 920d3d4b
...@@ -3,8 +3,12 @@ from validateConstraints import * ...@@ -3,8 +3,12 @@ from validateConstraints import *
from simtk.openmm.app import * from simtk.openmm.app import *
from simtk.openmm import * from simtk.openmm import *
from simtk.unit import * from simtk.unit import *
from simtk.openmm.app.gromacstopfile import _defaultGromacsIncludeDir
import simtk.openmm.app.element as elem import simtk.openmm.app.element as elem
GROMACS_INCLUDE = _defaultGromacsIncludeDir()
@unittest.skipIf(not os.path.exists(GROMACS_INCLUDE), 'GROMACS is not installed')
class TestGromacsTopFile(unittest.TestCase): class TestGromacsTopFile(unittest.TestCase):
"""Test the GromacsTopFile.createSystem() method.""" """Test the GromacsTopFile.createSystem() method."""
......
import sys
import unittest import unittest
from simtk.openmm.app import * from simtk.openmm.app import *
from simtk.openmm import * from simtk.openmm import *
from simtk.unit import * from simtk.unit import *
import simtk.openmm.app.element as elem import simtk.openmm.app.element as elem
import cStringIO if sys.version_info >= (3, 0):
from io import StringIO
else:
from cStringIO import StringIO
class TestPdbFile(unittest.TestCase): class TestPdbFile(unittest.TestCase):
"""Test the PDB file parser""" """Test the PDB file parser"""
...@@ -43,9 +48,9 @@ class TestPdbFile(unittest.TestCase): ...@@ -43,9 +48,9 @@ class TestPdbFile(unittest.TestCase):
def test_WriteFile(self): def test_WriteFile(self):
"""Write a file, read it back, and make sure it matches the original.""" """Write a file, read it back, and make sure it matches the original."""
pdb1 = PDBFile('systems/triclinic.pdb') pdb1 = PDBFile('systems/triclinic.pdb')
output = cStringIO.StringIO() output = StringIO()
PDBFile.writeFile(pdb1.topology, pdb1.positions, output) PDBFile.writeFile(pdb1.topology, pdb1.positions, output)
input = cStringIO.StringIO(output.getvalue()) input = StringIO(output.getvalue())
pdb2 = PDBFile(input) pdb2 = PDBFile(input)
output.close(); output.close();
input.close(); input.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment