Skip to content

Commit

Permalink
Update pyccc req to fix unicode bug, test tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
avirshup committed Jun 19, 2017
1 parent 4939b93 commit b83faa3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deployment/codeship_runtests.sh
Expand Up @@ -5,7 +5,7 @@
set -e

VERSION="${TESTENV}.py${PYVERSION}"
PYTESTFLAGS="-n 6 --durations=20 --junit-xml=/opt/reports/junit.${VERSION}.xml --timeout=1800"
PYTESTFLAGS="-n 5 --durations=20 --junit-xml=/opt/reports/junit.${VERSION}.xml --timeout=1800 --tb=short"
if [ "${VERSION}" == "complete.py3" ]; then
PYTESTFLAGS="--cov moldesign ${PYTESTFLAGS}"
fi
Expand Down
14 changes: 14 additions & 0 deletions moldesign/_tests/test_tools.py
Expand Up @@ -50,6 +50,20 @@ def test_ammonium_formal_charge(objkey, request):
assert atom.formal_charge == 0 * u.q_e


def test_set_hybridization_and_saturate():
# Creates just the carbons of ethylene, expects the routine to figure out the rest
atom1 = mdt.Atom(6)
atom2 = mdt.Atom(6)
atom2.x = 1.35 * u.angstrom
atom1.bond_to(atom2, 1)
mol = mdt.Molecule([atom1, atom2])
newmol = mdt.set_hybridization_and_saturate(mol)
pytest.xfail('This is apparently broken')
assert newmol.num_atoms == 6
assert newmol.atoms[0].bond_graph[atom1] == 2
assert len(newmol.get_atoms(atnum=1)) == 4


@pytest.fixture
def c2_no_hydrogen_from_smiles():
mymol = mdt.from_smiles('[CH0][CH0]')
Expand Down
10 changes: 9 additions & 1 deletion moldesign/fileio.py
Expand Up @@ -324,6 +324,13 @@ def read_xyz(f):
return mdt.Molecule(tempmol.atoms)


def write_xyz(mol, fileobj):
fileobj.write(" %d\n%s\n" % (mol.num_atoms, mol.name))
for atom in mol.atoms:
x, y, z = atom.position.value_in(mdt.units.angstrom)
fileobj.write("%s %24.14f %24.14f %24.14f\n" % (atom.element, x, y, z))


@utils.exports
def from_pdb(pdbcode, usecif=False):
""" Import the given molecular geometry from PDB.org
Expand Down Expand Up @@ -442,7 +449,8 @@ def _get_format(filename, format):
'xyz': read_xyz}

WRITERS = {'pdb': write_pdb,
'mmcif': write_mmcif}
'mmcif': write_mmcif,
'xyz': write_xyz}

if PY2:
bzopener = bz2.BZ2File
Expand Down
6 changes: 6 additions & 0 deletions pytest.ini
@@ -0,0 +1,6 @@
[pytest]
testpaths = moldesign/_tests

markers =
base: tests data structures, molecule construction
slow: heavy duty simulation and numerical tests
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -7,7 +7,7 @@ numpy >= 1.12
pathlib2 ; python_version < '3.3'
parmed >= 2.7.3
pint >= 0.8
pyccc >= 0.7.7
pyccc >= 0.7.9
pyyaml
requests
scipy
Expand Down

0 comments on commit b83faa3

Please sign in to comment.