From 6c61b831fe3f4ea2e3c85bc525505649227f5293 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 3 Sep 2020 12:19:49 -0400 Subject: [PATCH 1/3] Made tests not installable --- .travis.yml | 4 +-- setup.py | 41 +++++++++++++------------------ tests/__init__.py | 11 --------- tests/fileformats/__init__.py | 5 ---- tests/fileformats/top/__init__.py | 5 ---- 5 files changed, 19 insertions(+), 47 deletions(-) delete mode 100644 tests/__init__.py delete mode 100644 tests/fileformats/__init__.py delete mode 100644 tests/fileformats/top/__init__.py diff --git a/.travis.yml b/.travis.yml index 91b2b513..81c24268 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ env: - GROMACS_VERSION=4.6.5 PYTHON_VERSION=3.6 - GROMACS_VERSION=2018.6 PYTHON_VERSION=3.6 - GROMACS_VERSION=2019.1 PYTHON_VERSION=3.6 - - GROMACS_VERSION=2019.1 PYTHON_VERSION=3.7 + - GROMACS_VERSION=2019.1 PYTHON_VERSION=3.7 # Test "append_suffix" implementation - GROMACS_VERSION=2018.6 PYTHON_VERSION=3.6 SETUP_CMD="${SETUP_CMD} --link-gmx-mpi --no-append-suffix" @@ -44,7 +44,7 @@ matrix: include: # see Gromacs packages on bioconda https://anaconda.org/bioconda/gromacs/files - os: osx - env: GROMACS_VERSION=4.6.5 PYTHON_VERSION=3.6 + env: GROMACS_VERSION=4.6.5 PYTHON_VERSION=3.6 - os: osx env: GROMACS_VERSION=2019.1 PYTHON_VERSION=2.7 NUMPY_VERSION=1.16 - os: osx diff --git a/setup.py b/setup.py index b76713d0..608a40bb 100644 --- a/setup.py +++ b/setup.py @@ -35,31 +35,24 @@ 'Topic :: Scientific/Engineering :: Chemistry', 'Topic :: Software Development :: Libraries :: Python Modules', ], - packages=find_packages(exclude=['tests','scripts','extras','doc/examples']), - scripts = [ - 'scripts/gw-join_parts.py', - 'scripts/gw-merge_topologies.py', - 'scripts/gw-forcefield.py', - 'scripts/gw-partial_tempering.py', - ], + packages=find_packages( + exclude=['scripts', 'tests', 'extras', 'doc/examples']), + scripts=[ + 'scripts/gw-join_parts.py', + 'scripts/gw-merge_topologies.py', + 'scripts/gw-forcefield.py', + 'scripts/gw-partial_tempering.py', + ], package_data={'gromacs': ['templates/*.sge', 'templates/*.pbs', # template files 'templates/*.ll', 'templates/*.sh', - 'templates/*.mdp', 'templates/*.cfg', - 'tests/data/fileformats/top/*.mdp', # test data - 'tests/data/fileformats/top/*.bz2', - 'tests/data/fileformats/top/*/*.top', - 'tests/data/fileformats/top/*/*.gro', - 'tests/data/*.log', - 'tests/data/*.ndx', + 'templates/*.mdp', 'templates/*.cfg' ], }, - install_requires = ['numpy>=1.0', - 'six', # towards py 3 compatibility - 'numkit', # numerical helpers - 'matplotlib', - ], - tests_require = ['pytest', 'numpy>=1.0', 'pandas>=0.17'], - zip_safe = True, -) - - + install_requires=['numpy>=1.0', + 'six', # towards py 3 compatibility + 'numkit', # numerical helpers + 'matplotlib', + ], + tests_require=['pytest', 'numpy>=1.0', 'pandas>=0.17'], + zip_safe=True, + ) diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index a8a6da4f..00000000 --- a/tests/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# This *should* allow us to run if DISPLAY is not set... -# ... however, Linux builds on Travis CI still fail. -# -# Instead of setting up a headless X server as in -# https://stackoverflow.com/questions/35403127/testing-matplotlib-based-plots-in-travis-ci -# I will set MPLBACKEND=agg -# (https://matplotlib.org/faq/environment_variables_faq.html) -# -# The following is left because (1) harmless and (2) documentation -import matplotlib -matplotlib.use('agg') diff --git a/tests/fileformats/__init__.py b/tests/fileformats/__init__.py deleted file mode 100644 index d639b535..00000000 --- a/tests/fileformats/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# GromacsWrapper: top.py -# Copyright (c) 2009 Oliver Beckstein -# Released under the GNU Public License 3 (or higher, your choice) -# See the file COPYING for details. - diff --git a/tests/fileformats/top/__init__.py b/tests/fileformats/top/__init__.py deleted file mode 100644 index d639b535..00000000 --- a/tests/fileformats/top/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# GromacsWrapper: top.py -# Copyright (c) 2009 Oliver Beckstein -# Released under the GNU Public License 3 (or higher, your choice) -# See the file COPYING for details. - From 35dc54fd5dc1dda2f1ca563e504a2fae0e6a2bd1 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 3 Sep 2020 13:03:22 -0400 Subject: [PATCH 2/3] Fixed relative imports in tests --- setup.py | 2 +- tests/__init__.py | 11 +++++++++++ tests/fileformats/__init__.py | 4 ++++ tests/fileformats/top/__init__.py | 4 ++++ tests/test_cbook.py | 5 +++-- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/fileformats/__init__.py create mode 100644 tests/fileformats/top/__init__.py diff --git a/setup.py b/setup.py index 608a40bb..b57df831 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ 'Topic :: Software Development :: Libraries :: Python Modules', ], packages=find_packages( - exclude=['scripts', 'tests', 'extras', 'doc/examples']), + exclude=['scripts', 'tests', 'tests.*', 'extras', 'doc/examples']), scripts=[ 'scripts/gw-join_parts.py', 'scripts/gw-merge_topologies.py', diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..a8a6da4f --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,11 @@ +# This *should* allow us to run if DISPLAY is not set... +# ... however, Linux builds on Travis CI still fail. +# +# Instead of setting up a headless X server as in +# https://stackoverflow.com/questions/35403127/testing-matplotlib-based-plots-in-travis-ci +# I will set MPLBACKEND=agg +# (https://matplotlib.org/faq/environment_variables_faq.html) +# +# The following is left because (1) harmless and (2) documentation +import matplotlib +matplotlib.use('agg') diff --git a/tests/fileformats/__init__.py b/tests/fileformats/__init__.py new file mode 100644 index 00000000..ccc39f61 --- /dev/null +++ b/tests/fileformats/__init__.py @@ -0,0 +1,4 @@ +# GromacsWrapper: top.py +# Copyright (c) 2009 Oliver Beckstein +# Released under the GNU Public License 3 (or higher, your choice) +# See the file COPYING for details. diff --git a/tests/fileformats/top/__init__.py b/tests/fileformats/top/__init__.py new file mode 100644 index 00000000..ccc39f61 --- /dev/null +++ b/tests/fileformats/top/__init__.py @@ -0,0 +1,4 @@ +# GromacsWrapper: top.py +# Copyright (c) 2009 Oliver Beckstein +# Released under the GNU Public License 3 (or higher, your choice) +# See the file COPYING for details. diff --git a/tests/test_cbook.py b/tests/test_cbook.py index 9ec3825d..e0220d8f 100644 --- a/tests/test_cbook.py +++ b/tests/test_cbook.py @@ -10,14 +10,15 @@ from gromacs import cbook import gromacs.setup -from .datafiles import datafile +from datafiles import datafile + def test_grompp_qtot(tmpdir): pdb = datafile("1ake_A.pdb") top = tmpdir.mkdir("top") with top.as_cwd(): f = gromacs.setup.topology(struct=pdb, ff="oplsaa", water="tip4p") - with open('none.mdp','w') as mdp: + with open('none.mdp', 'w') as mdp: mdp.write('; empty mdp file\nrcoulomb = 1\nrvdw = 1\nrlist = 1\n') qtot = cbook.grompp_qtot(f="none.mdp", c=f['struct'], p=f['top'], stdout=False, maxwarn=10) From adb218e91c651aaa9d7ce59390b876d7d83da59b Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 3 Sep 2020 14:24:31 -0400 Subject: [PATCH 3/3] Fixed missed relative import --- tests/test_cbook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cbook.py b/tests/test_cbook.py index e0220d8f..57506659 100644 --- a/tests/test_cbook.py +++ b/tests/test_cbook.py @@ -10,7 +10,7 @@ from gromacs import cbook import gromacs.setup -from datafiles import datafile +from .datafiles import datafile def test_grompp_qtot(tmpdir):