Skip to content

Commit

Permalink
Merge pull request #7 from theavey/ParaTemp-4-install
Browse files Browse the repository at this point in the history
Test on Travis-CI using locally installed package
  • Loading branch information
theavey authored Jan 30, 2018
2 parents f29efa7 + b056424 commit 55a4e30
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 35 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
language: python

# command to install dependencies
python:
- "2.7"
- "3.6"

# command to install dependencies and package
install:
- pip install -r requirements.txt
- python setup.py install
# command to run tests
script:
- pytest # or py.test for Python versions 3.5 and below
- py.test # or py.test for Python versions 3.5 and below
Empty file removed __init__.py
Empty file.
4 changes: 2 additions & 2 deletions paratemp/coordinate_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

########################################################################
# #
# This script was written by Thomas Heavey in 2017. #
# This script was written by Thomas Heavey in 2018. #
# [email protected] [email protected] #
# #
# Copyright 2017 Thomas J. Heavey IV #
# Copyright 2017, 2018 Thomas J. Heavey IV #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
VCS = git
style = pep440
versionfile_source = paratemp/_version.py
tag_prefix = paratemp-
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from distutils.core import setup
from setuptools import setup
import versioneer

setup(
name='ParaTemp',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
packages=['paratemp'],
scripts=['check-convergence.py'],
url='https://github.com/theavey/ParaTemp',
license='Apache License 2.0',
author='Thomas Heavey',
author_email='[email protected]',
description='Scripts for molecular dynamics analysis and parallel tempering in GROMACS'
description='Scripts for molecular dynamics analysis and parallel '
'tempering in GROMACS'
)
20 changes: 10 additions & 10 deletions tests/test_CoordinateAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

########################################################################
# #
# This script was written by Thomas Heavey in 2017. #
# This script was written by Thomas Heavey in 2018. #
# [email protected] [email protected] #
# #
# Copyright 2017 Thomas J. Heavey IV #
# Copyright 2017-18 Thomas J. Heavey IV #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
Expand Down Expand Up @@ -39,7 +39,7 @@ def test_matplotlib_testing_backend():


def test_running_mean():
from ..paratemp.coordinate_analysis import _running_mean
from paratemp.coordinate_analysis import _running_mean
tl = [0, 2, 4]
assert (_running_mean(tl) == [1, 3]).all()

Expand All @@ -48,7 +48,7 @@ class TestXTCUniverse(object):

@pytest.fixture
def univ(self):
from ..paratemp import coordinate_analysis as ca
from paratemp import coordinate_analysis as ca
_univ = ca.Universe('tests/test-data/spc2.gro',
'tests/test-data/t-spc2-traj.xtc',
temp=205.)
Expand All @@ -61,7 +61,7 @@ def univ_w_a(self, univ):

@pytest.fixture
def univ_pbc(self):
from ..paratemp import coordinate_analysis as ca
from paratemp import coordinate_analysis as ca
_univ = ca.Universe('tests/test-data/spc2.gro',
'tests/test-data/spc2-traj-pbc.xtc',
temp=205.)
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_calculate_distances_no_recalc(self, univ_w_a, capsys):

def test_calculate_distances_yes_recalc(self, univ_w_a):
"""
:type univ_w_a: ParaTemp.CoordinateAnalysis.Universe
:type univ_w_a: paratemp.coordinate_analysis.Universe
"""
univ_w_a.calculate_distances(a='5 5', recalculate=True)
assert (np.array([0., 0.]) == univ_w_a.data['a']).all()
Expand All @@ -129,13 +129,13 @@ def test_distance_pbc(self, univ_pbc, ref_a_pbc_dists):
def test_calc_fes_1d(self, univ_w_a, ref_delta_g, ref_bins, ref_delta_g_20,
ref_bins_20):
"""
:type univ_w_a: ParaTemp.CoordinateAnalysis.Universe
:type univ_w_a: paratemp.coordinate_analysis.Universe
:type ref_delta_g: np.ndarray
:type ref_bins: np.ndarray
:type ref_delta_g_20: np.ndarray
:type ref_bins_20: np.ndarray
"""
from ..paratemp.coordinate_analysis import _calc_fes_1d
from paratemp.coordinate_analysis import _calc_fes_1d
delta_g_data, bins_data = _calc_fes_1d(univ_w_a.data['a'], temp=205.,
bins=None)
assert (delta_g_data == ref_delta_g).all()
Expand All @@ -147,7 +147,7 @@ def test_calc_fes_1d(self, univ_w_a, ref_delta_g, ref_bins, ref_delta_g_20,

def test_fes_1d_data_str(self, univ_w_a, ref_delta_g, ref_bins):
"""
:type univ_w_a: ParaTemp.CoordinateAnalysis.Universe
:type univ_w_a: paratemp.coordinate_analysiss.Universe
:type ref_delta_g: np.ndarray
:type ref_bins: np.ndarray
"""
Expand All @@ -158,7 +158,7 @@ def test_fes_1d_data_str(self, univ_w_a, ref_delta_g, ref_bins):

def test_fes_1d_data_data(self, univ_w_a, ref_delta_g, ref_bins):
"""
:type univ_w_a: ParaTemp.CoordinateAnalysis.Universe
:type univ_w_a: paratemp.coordinate_analysis.Universe
:type ref_delta_g: np.ndarray
:type ref_bins: np.ndarray
"""
Expand Down
16 changes: 8 additions & 8 deletions tests/test_geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

########################################################################
# #
# This script was written by Thomas Heavey in 2017. #
# This script was written by Thomas Heavey in 2018. #
# [email protected] [email protected] #
# #
# Copyright 2017 Thomas J. Heavey IV #
# Copyright 2017-18 Thomas J. Heavey IV #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
Expand All @@ -32,7 +32,7 @@ class TestXYZ(object):

@pytest.fixture
def xyz(self):
from ..paratemp.geometries import XYZ
from paratemp.geometries import XYZ
return XYZ('tests/test-data/stil-3htmf.xyz')

def test_n_atoms(self, xyz):
Expand All @@ -51,27 +51,27 @@ def pi(self):

@pytest.fixture
def x_axis_int_list(self):
from ..paratemp.geometries import Vector
from paratemp.geometries import Vector
return Vector([1, 0, 0])

@pytest.fixture
def x_axis_float_list(self):
from ..paratemp.geometries import Vector
from paratemp.geometries import Vector
return Vector([1., 0., 0.])

@pytest.fixture
def x_axis_int(self):
from ..paratemp.geometries import Vector
from paratemp.geometries import Vector
return Vector(1, 0, 0)

@pytest.fixture
def y_axis(self):
from ..paratemp.geometries import Vector
from paratemp.geometries import Vector
return Vector(0, 1, 0)

@pytest.fixture
def z_axis(self):
from ..paratemp.geometries import Vector
from paratemp.geometries import Vector
return Vector(0, 0, 1)

def test_input_int_float(self, x_axis_int_list, x_axis_float_list):
Expand Down
16 changes: 8 additions & 8 deletions tests/test_sim_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

########################################################################
# #
# This script was written by Thomas Heavey in 2017. #
# This script was written by Thomas Heavey in 2018. #
# [email protected] [email protected] #
# #
# Copyright 2017 Thomas J. Heavey IV #
# Copyright 2017-18 Thomas J. Heavey IV #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
Expand All @@ -30,7 +30,7 @@


def test_job_info_from_qsub():
from ..paratemp.sim_setup import _job_info_from_qsub
from paratemp.sim_setup import _job_info_from_qsub
job_info = _job_info_from_qsub('Your job 2306551 ("PT-NTD-CG") '
'has been submitted')
assert job_info == ('2306551', 'PT-NTD-CG', '2306551 ("PT-NTD-CG")')
Expand Down Expand Up @@ -62,14 +62,14 @@ def rd1030(self):
return {10: 30}

def test_update_num(self, match_10, rd1030):
from ..paratemp.sim_setup import _update_num
from paratemp.sim_setup import _update_num
assert '=30' == _update_num(match_10, shift=10, cat_repl_dict=rd1030)
assert '=1' == _update_num(match_10, shift=9, cat_repl_dict=dict())
assert '=1' == _update_num(match_10, shift=9, cat_repl_dict=rd1030)

def test_update_num_raises(self, match_10, match_text, match_float,
match_bad_few, match_bad_many):
from ..paratemp.sim_setup import _update_num
from paratemp.sim_setup import _update_num
with pytest.raises(KeyError):
_update_num(match_10, shift=10, cat_repl_dict=dict())
with pytest.raises(ValueError,
Expand Down Expand Up @@ -102,19 +102,19 @@ def folder_dc(n_top_dc):
class TestGetSolvCountTop(object):

def test_get_solv_count_top(self, n_top_dc, folder_dc):
from ..paratemp.sim_setup import get_solv_count_top
from paratemp.sim_setup import get_solv_count_top
assert get_solv_count_top(n_top_dc) == 361
assert get_solv_count_top(folder=folder_dc) == 361


class TestSetSolvCountTop(object):

def test_set_solv_count_top_n(self, n_top_dc):
from ..paratemp.sim_setup import set_solv_count_top, get_solv_count_top
from paratemp.sim_setup import set_solv_count_top, get_solv_count_top
set_solv_count_top(n_top_dc, s_count=100)
assert get_solv_count_top(n_top_dc) == 100

def test_set_solv_count_top_folder(self, folder_dc, n_top_dc):
from ..paratemp.sim_setup import set_solv_count_top, get_solv_count_top
from paratemp.sim_setup import set_solv_count_top, get_solv_count_top
set_solv_count_top(folder=folder_dc, s_count=50)
assert get_solv_count_top(n_top_dc) == 50
6 changes: 3 additions & 3 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

########################################################################
# #
# This script was written by Thomas Heavey in 2017. #
# This script was written by Thomas Heavey in 2018. #
# [email protected] [email protected] #
# #
# Copyright 2017 Thomas J. Heavey IV #
# Copyright 2017-18 Thomas J. Heavey IV #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
Expand Down Expand Up @@ -34,5 +34,5 @@ def ref_temps():


def test_get_temps(ref_temps):
from ..paratemp import get_temperatures
from paratemp import get_temperatures
assert (get_temperatures('tests/test-data/temperatures.dat') == ref_temps).all()

0 comments on commit 55a4e30

Please sign in to comment.