"plugins/vscode:/vscode.git/clone" did not exist on "8b3c38f9e2c8173d78b45956ffc85dff1212844d"
Commit e05f0ea0 authored by peastman's avatar peastman
Browse files

Merge pull request #1094 from rmcgibbo/rmcgibbo-patch-2

Assorted windows / appveyor fixes. Mostly cosmetic.
parents 3924b168 23143e82
...@@ -41,11 +41,11 @@ script: ...@@ -41,11 +41,11 @@ script:
- # Run the testInstallation script - # Run the testInstallation script
- python -m simtk.testInstallation - python -m simtk.testInstallation
- # run all of the tests, making sure failures at this stage don't cause travis failures - # run all of the tests, making sure failures at this stage don't cause travis failures
- ctest -j2 -V || true - ctest -j2 || true
- # get a list of all of the failed tests into this stupid ctest format - # get a list of all of the failed tests into this stupid ctest format
- python -c 'fn = "Testing/Temporary/LastTestsFailed.log"; import os; os.path.exists(fn) or exit(0); l = [line.split(":")[0] for line in open(fn)]; triplets = zip(l, l, [","]*len(l)); print "".join(",".join(t) for t in triplets)' > FailedTests.log - python -c 'fn = "Testing/Temporary/LastTestsFailed.log"; import os; os.path.exists(fn) or exit(0); l = [line.split(":")[0] for line in open(fn)]; triplets = zip(l, l, [","]*len(l)); print "".join(",".join(t) for t in triplets)' > FailedTests.log
- # rerun all of the failed tests - # rerun all of the failed tests
- if [ -s FailedTests.log ]; then ctest -V -I FailedTests.log; fi; - if [ -s Testing/Temporary/LastTestsFailed.log ]; then ctest -I FailedTests.log; fi;
- # run the python tests too - # run the python tests too
- cd python/tests - cd python/tests
- pip install nose - pip install nose
......
...@@ -122,7 +122,10 @@ ELSE (APPLE AND (NOT PNACL)) ...@@ -122,7 +122,10 @@ ELSE (APPLE AND (NOT PNACL))
IF (MSVC OR ANDROID OR PNACL) IF (MSVC OR ANDROID OR PNACL)
SET(EXTRA_COMPILE_FLAGS) SET(EXTRA_COMPILE_FLAGS)
IF (MSVC) IF (MSVC)
# Use warning level 2, not whatever warning level CMake picked.
STRING(REGEX REPLACE "/W[0-4]" "/W2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") STRING(REGEX REPLACE "/W[0-4]" "/W2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# Explicitly suppress warnings 4305 and 4244.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4305 /wd4244")
ENDIF (MSVC) ENDIF (MSVC)
ELSE (MSVC OR ANDROID OR PNACL) ELSE (MSVC OR ANDROID OR PNACL)
SET(EXTRA_COMPILE_FLAGS "-msse2") SET(EXTRA_COMPILE_FLAGS "-msse2")
......
...@@ -35,11 +35,13 @@ install: ...@@ -35,11 +35,13 @@ install:
build: false build: false
test_script: test_script:
- ctest && exit 0 - ctest || exit 0
- python -c "import os; fn = os.path.join('Testing', 'Temporary', 'LastTestsFailed.log'); os.path.exists(fn) or exit(0); l = [line.split(':')[0] for line in open(fn)]; triplets = zip(l, l, [',']*len(l)); print(''.join(','.join(t) for t in triplets))" > FailedTests.log - python -c "import os; fn = os.path.join('Testing', 'Temporary', 'LastTestsFailed.log'); os.path.exists(fn) or exit(0); failed = [line.split(':')[0] for line in open(fn)]; print(','.join(x+','+x for x in failed))" > FailedTests.log
- ps: > - ps: >
If (Test-Path "FailedTests.log") { If (Test-Path "Testing\\Temporary\\LastTestsFailed.log") {
ctest -V -I FailedTests.log cat Testing\\Temporary\\LastTestsFailed.log
cat FailedTests.log
ctest -I FailedTests.log
} }
- cd python\tests - cd python\tests
- nosetests -vv --processes=-1 --process-timeout=200 - nosetests -vv --processes=-1 --process-timeout=200
......
...@@ -4,11 +4,18 @@ from simtk.openmm.app import * ...@@ -4,11 +4,18 @@ 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
try:
from scipy.io import netcdf
SCIPY_IMPORT_FAILED = False
except:
SCIPY_IMPORT_FAILED = True
def compareByElement(array1, array2, cmp): def compareByElement(array1, array2, cmp):
for x, y in zip(array1, array2): for x, y in zip(array1, array2):
cmp(x, y) cmp(x, y)
class TestAmberInpcrdFile(unittest.TestCase): class TestAmberInpcrdFile(unittest.TestCase):
"""Test the Amber inpcrd file parser""" """Test the Amber inpcrd file parser"""
...@@ -24,14 +31,11 @@ class TestAmberInpcrdFile(unittest.TestCase): ...@@ -24,14 +31,11 @@ class TestAmberInpcrdFile(unittest.TestCase):
compareByElement(inpcrd.boxVectors[0].value_in_unit(angstroms), compareByElement(inpcrd.boxVectors[0].value_in_unit(angstroms),
[30.2642725, 0.0, 0.0], cmp) [30.2642725, 0.0, 0.0], cmp)
@unittest.skipIf(SCIPY_IMPORT_FAILED, "Scipy is not installed")
def test_NetCDF(self): def test_NetCDF(self):
""" Test NetCDF restart file parsing """ """ Test NetCDF restart file parsing """
cmp = self.assertAlmostEqual cmp = self.assertAlmostEqual
try:
from scipy.io import netcdf
except ImportError:
print('Not testing NetCDF file parser... scipy cannot be found')
else:
inpcrd = AmberInpcrdFile('systems/amber.ncrst') inpcrd = AmberInpcrdFile('systems/amber.ncrst')
self.assertEqual(len(inpcrd.positions), 2101) self.assertEqual(len(inpcrd.positions), 2101)
compareByElement(inpcrd.positions[0].value_in_unit(angstroms), compareByElement(inpcrd.positions[0].value_in_unit(angstroms),
......
import os import os
import unittest import unittest
import tempfile import tempfile
import numpy as np
from simtk.openmm import app from simtk.openmm import app
import simtk.openmm as mm import simtk.openmm as mm
from simtk import unit from simtk import unit
...@@ -24,17 +23,19 @@ class TestCheckpointReporter(unittest.TestCase): ...@@ -24,17 +23,19 @@ class TestCheckpointReporter(unittest.TestCase):
self.simulation.step(1) self.simulation.step(1)
# get the current positions # get the current positions
positions = self.simulation.context.getState(getPositions=True).getPositions(asNumpy=True)._value positions = self.simulation.context.getState(getPositions=True).getPositions()
# now set the positions into junk... # now set the positions into junk...
self.simulation.context.setPositions(np.random.random(positions.shape)) self.simulation.context.setPositions([mm.Vec3(0, 0, 0)] * len(positions))
# then reload the right positions from the checkpoint # then reload the right positions from the checkpoint
file.close() file.close()
with open(file.name, 'rb') as f: with open(file.name, 'rb') as f:
self.simulation.context.loadCheckpoint(f.read()) self.simulation.context.loadCheckpoint(f.read())
os.unlink(file.name) os.unlink(file.name)
newPositions = self.simulation.context.getState(getPositions=True).getPositions(asNumpy=True)._value newPositions = self.simulation.context.getState(getPositions=True).getPositions()
np.testing.assert_array_equal(positions, newPositions) self.assertSequenceEqual(positions, newPositions)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
import unittest import unittest
import numpy as np
from simtk.openmm import app from simtk.openmm import app
import simtk.openmm as mm import simtk.openmm as mm
from simtk import unit from simtk import unit
try:
import numpy as np
NUMPY_IMPORT_FAILED = False
except ImportError:
NUMPY_IMPORT_FAILED = True
@unittest.skipIf(NUMPY_IMPORT_FAILED, 'Numpy is not installed')
class TestNumpyCompatibility(unittest.TestCase): class TestNumpyCompatibility(unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -80,6 +85,8 @@ class TestNumpyCompatibility(unittest.TestCase): ...@@ -80,6 +85,8 @@ class TestNumpyCompatibility(unittest.TestCase):
self.assertEqual(size, 10) self.assertEqual(size, 10)
np.testing.assert_array_almost_equal(energy, np.asarray(energy_out)) np.testing.assert_array_almost_equal(energy, np.asarray(energy_out))
@unittest.skipIf(NUMPY_IMPORT_FAILED, 'Numpy is not installed')
class TestNumpyUnits(unittest.TestCase): class TestNumpyUnits(unittest.TestCase):
def setUp(self): def setUp(self):
......
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