From a27c025593d30df71ea77b512ac89176f0c04d57 Mon Sep 17 00:00:00 2001 From: sroet Date: Thu, 24 Dec 2020 16:38:59 +0100 Subject: [PATCH 1/5] fix omt is None error in test suite --- openpathsampling/tests/test_features.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/openpathsampling/tests/test_features.py b/openpathsampling/tests/test_features.py index aed30b507..6c833a7e6 100644 --- a/openpathsampling/tests/test_features.py +++ b/openpathsampling/tests/test_features.py @@ -1,12 +1,10 @@ from __future__ import absolute_import from builtins import hex from builtins import object -from nose.tools import (assert_equal, assert_not_equal, - assert_almost_equal, raises, assert_in) +from nose.tools import raises -from nose.plugins.skip import Skip, SkipTest -from .test_helpers import (true_func, assert_equal_array_array, - make_1d_traj, assert_items_equal, u) +from nose.plugins.skip import SkipTest +from .test_helpers import u import logging @@ -43,7 +41,7 @@ def test_copy_with_replacement_toy(self): assert(toy_copy.velocities[1] == 1.0) def test_copy_with_replacement_openmm(self): - if not paths.integration_tools.HAS_OPENMM: + if not paths.integration_tools.HAS_OPENMM or omt is None: raise SkipTest # test an openmm snapshot sys = omt.testsystems.AlanineDipeptideVacuum() @@ -71,4 +69,4 @@ def test_parameter_error(self): init_vel = np.array([3.0, 4.0]) toy_snap = toy_engine.Snapshot( coordinates=init_coord, velocities=init_vel) - toy_copy = toy_snap.copy_with_replacement(dummy=0) + toy_snap.copy_with_replacement(dummy=0) From 2c778a594d4aee02196d876b50f186612a50e3a4 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Fri, 25 Dec 2020 04:13:32 +0100 Subject: [PATCH 2/5] Bump to version 1.4.1.dev0 --- openpathsampling/netcdfplus/version.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openpathsampling/netcdfplus/version.py b/openpathsampling/netcdfplus/version.py index 331c46893..9eeb901e8 100644 --- a/openpathsampling/netcdfplus/version.py +++ b/openpathsampling/netcdfplus/version.py @@ -1,4 +1,4 @@ -short_version = '1.4.0' +short_version = '1.4.1.dev0' version = short_version full_version = short_version git_revision = 'alpha' diff --git a/setup.cfg b/setup.cfg index cad157f83..727114c4f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = openpathsampling -version = 1.4.0 +version = 1.4.1.dev0 description = A Python package for path sampling simulations long_description = file: README.md long_description_content_type = text/markdown From 6bba3873c32804abfa85d305a3ef688412846818 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Sun, 27 Dec 2020 13:34:03 +0100 Subject: [PATCH 3/5] Fix so SimStore tests pass if no simtk.unit --- .../experimental/simstore/test_custom_json.py | 1 - openpathsampling/experimental/storage/ops_storage.py | 12 +++++++++--- .../storage/test_collective_variables.py | 1 + setup.cfg | 3 +++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/openpathsampling/experimental/simstore/test_custom_json.py b/openpathsampling/experimental/simstore/test_custom_json.py index d01d0d619..95192257d 100644 --- a/openpathsampling/experimental/simstore/test_custom_json.py +++ b/openpathsampling/experimental/simstore/test_custom_json.py @@ -4,7 +4,6 @@ import numpy as np from numpy import testing as npt -from simtk import unit from . import test_utils diff --git a/openpathsampling/experimental/storage/ops_storage.py b/openpathsampling/experimental/storage/ops_storage.py index 2c62d4833..8320cb013 100644 --- a/openpathsampling/experimental/storage/ops_storage.py +++ b/openpathsampling/experimental/storage/ops_storage.py @@ -40,7 +40,11 @@ from . import snapshots from .snapshots_table import SnapshotsTable -from .simtk_unit import simtk_quantity_codec, SimtkQuantityHandler +try: + from .simtk_unit import simtk_quantity_codec, SimtkQuantityHandler +except ImportError: + simtk_quantity_codec = None + SimtkQuantityHandler = None import logging logger = logging.getLogger(__name__) @@ -71,8 +75,10 @@ ops_schema_sql_metadata = {} # this defines the simulation object serializer for OPS -CODECS = DEFAULT_CODECS + [simtk_quantity_codec] -HANDLERS = DEFAULT_HANDLERS + [SimtkQuantityHandler] +EXTRA_CODECS = [simtk_quantity_codec] if simtk_quantity_codec else [] +EXTRA_HANDLERS = [SimtkQuantityHandler] if SimtkQuantityHandler else [] +CODECS = DEFAULT_CODECS + EXTRA_CODECS +HANDLERS = DEFAULT_HANDLERS + EXTRA_HANDLERS UNSAFE_CODECS = CODECS + [CallableCodec()] SAFE_CODECS = CODECS + [CallableCodec({'safemode': True})] diff --git a/openpathsampling/experimental/storage/test_collective_variables.py b/openpathsampling/experimental/storage/test_collective_variables.py index 333367510..7436612e5 100644 --- a/openpathsampling/experimental/storage/test_collective_variables.py +++ b/openpathsampling/experimental/storage/test_collective_variables.py @@ -119,6 +119,7 @@ class TestMDTrajFunctionCV(object): def setup(self): if not HAS_MDTRAJ: pytest.skip("Unable to import MDTraj") + pytest.importorskip('simtk.unit') self.mdt = md.load(data_filename("ala_small_traj.pdb")) top = ops_omm.topology.MDTrajTopology(self.mdt.topology) diff --git a/setup.cfg b/setup.cfg index 727114c4f..1cca9671e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,6 +49,9 @@ test = pytest-cov coveralls ipynbtest +simstore = + sqlalchemy + dill [bdist_wheel] universal = 1 From b5a24b5dda061496431d1b5cdfed653bd9c12920 Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Sun, 27 Dec 2020 13:48:52 +0100 Subject: [PATCH 4/5] Remove nose from test_helpers --- openpathsampling/tests/test_helpers.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/openpathsampling/tests/test_helpers.py b/openpathsampling/tests/test_helpers.py index 6e2043878..b0950ad6c 100644 --- a/openpathsampling/tests/test_helpers.py +++ b/openpathsampling/tests/test_helpers.py @@ -23,8 +23,6 @@ except ImportError: md = None -from nose.tools import assert_equal, assert_in, assert_true -#from nose.tools import assert_items_equal from pkg_resources import resource_filename import openpathsampling as paths @@ -61,20 +59,20 @@ def make_1d_traj(coordinates, velocities=None, engine=None): return paths.Trajectory(traj) def items_equal(truth, beauty): - assert_equal(len(truth), len(beauty)) + assert len(truth) == len(beauty) for (t, b) in zip(truth, beauty): if t != b: return False return True def assert_items_equal(truth, beauty): - assert_equal(len(truth), len(beauty)) + assert len(truth) == len(beauty) for (t, b) in zip(truth, beauty): - assert_equal(t, b) + assert t == b def assert_items_almost_equal(truth, beauty, tol=10e-7): for (t,b) in zip(truth, beauty): - assert_equal( abs(t-b) - tol < 0.0, True) + assert abs(t-b) - tol < 0.0 def assert_equal_array_array(truth, beauty): @@ -90,9 +88,9 @@ def assert_not_equal_array_array(list_a, list_b): return exist_diff def assert_same_items(list_a, list_b): - assert_equal(len(list_a), len(list_b)) + assert len(list_a) == len(list_b) for elem_a in list_a: - assert_in(elem_a, list_b) + assert elem_a in list_b class MoverWithSignature(paths.PathMover): @@ -306,18 +304,18 @@ def _wrapper(*args, **kwargs): return decorator def assert_frame_equal(truth, beauty): - assert_equal(len(truth.index), len(beauty.index)) - assert_equal(len(truth.columns), len(beauty.columns)) - assert_equal(set(truth.index), set(beauty.index)) - assert_equal(set(truth.columns), set(beauty.columns)) + assert len(truth.index) == len(beauty.index) + assert len(truth.columns) == len(beauty.columns) + assert set(truth.index) == set(beauty.index) + assert set(truth.columns) == set(beauty.columns) for idx in truth.index: for col in truth.columns: truth_val = truth.loc[idx, col] beauty_val = beauty.loc[idx, col] if np.isnan(truth_val): - assert_true(np.isnan(beauty_val)) + assert np.isnan(beauty_val) else: - assert_equal(truth_val, beauty_val) + assert truth_val == beauty_val def A2BEnsemble(volume_a, volume_b, trusted=True): # this is a little replacement for the same name that used to be in From 11c035f8adaa6e8a747b02198d57d6cf33a273ba Mon Sep 17 00:00:00 2001 From: "David W.H. Swenson" Date: Wed, 30 Dec 2020 11:22:13 +0100 Subject: [PATCH 5/5] Release 1.4.1 --- openpathsampling/netcdfplus/version.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openpathsampling/netcdfplus/version.py b/openpathsampling/netcdfplus/version.py index 9eeb901e8..9ff6701bf 100644 --- a/openpathsampling/netcdfplus/version.py +++ b/openpathsampling/netcdfplus/version.py @@ -1,4 +1,4 @@ -short_version = '1.4.1.dev0' +short_version = '1.4.1' version = short_version full_version = short_version git_revision = 'alpha' diff --git a/setup.cfg b/setup.cfg index 1cca9671e..54decdaa5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = openpathsampling -version = 1.4.1.dev0 +version = 1.4.1 description = A Python package for path sampling simulations long_description = file: README.md long_description_content_type = text/markdown