PythonPackage: Let There Be Tests! (#2869)

* Run python setup.py test if --run-tests
* Attempt to import the Python module after installation
* Add testing support to numpy and scipy
* Remove duplicated comments
* Update to new run-tests callback methodology
* Remove unrelated changes for another PR
This commit is contained in:
Adam J. Stewart
2017-03-31 15:39:07 -05:00
committed by Todd Gamblin
parent 3ade829566
commit bc404532ea
6 changed files with 167 additions and 7 deletions

View File

@@ -33,6 +33,22 @@ class PyScipy(PythonPackage):
homepage = "http://www.scipy.org/"
url = "https://pypi.io/packages/source/s/scipy/scipy-0.18.1.tar.gz"
install_time_test_callbacks = ['install_test', 'import_module_test']
import_modules = [
'scipy', 'scipy._build_utils', 'scipy._lib', 'scipy.cluster',
'scipy.constants', 'scipy.fftpack', 'scipy.integrate',
'scipy.interpolate', 'scipy.io', 'scipy.linalg', 'scipy.misc',
'scipy.ndimage', 'scipy.odr', 'scipy.optimize', 'scipy.signal',
'scipy.sparse', 'scipy.spatial', 'scipy.special', 'scipy.stats',
'scipy.weave', 'scipy.io.arff', 'scipy.io.harwell_boeing',
'scipy.io.matlab', 'scipy.optimize._lsq', 'scipy.sparse.csgraph',
'scipy.sparse.linalg', 'scipy.sparse.linalg.dsolve',
'scipy.sparse.linalg.eigen', 'scipy.sparse.linalg.isolve',
'scipy.sparse.linalg.eigen.arpack', 'scipy.sparse.linalg.eigen.lobpcg',
'scipy.special._precompute'
]
version('0.19.0', '91b8396231eec780222a57703d3ec550',
url="https://pypi.io/packages/source/s/scipy/scipy-0.19.0.zip")
version('0.18.1', '5fb5fb7ccb113ab3a039702b6c2f3327')
@@ -49,6 +65,10 @@ class PyScipy(PythonPackage):
depends_on('blas')
depends_on('lapack')
# Tests require:
# TODO: Add a 'test' deptype
# depends_on('py-nose', type='test')
def build_args(self, spec, prefix):
args = []
@@ -59,3 +79,22 @@ def build_args(self, spec, prefix):
args.extend(['-j', str(make_jobs)])
return args
def test(self):
# `setup.py test` is not supported. Use one of the following
# instead:
#
# - `python runtests.py` (to build and test)
# - `python runtests.py --no-build` (to test installed scipy)
# - `>>> scipy.test()` (run tests for installed scipy
# from within an interpreter)
pass
def install_test(self):
# Change directories due to the following error:
#
# ImportError: Error importing scipy: you should not try to import
# scipy from its source directory; please exit the scipy
# source tree, and relaunch your python interpreter from there.
with working_dir('..'):
python('-c', 'import scipy; scipy.test("full", verbose=2)')