Skip to content
Browse files

TST Add support for tox testing

  • Loading branch information...
1 parent 7099543 commit 93aa17f72c22833dc357dc3afefa553eeff71e3a @kwgoodman committed
Showing with 88 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +51 −0 tools/test-installed-la.py
  3. +36 −0 tox.ini
View
1 .gitignore
@@ -4,3 +4,4 @@ build
dist
MANIFEST
*.so
+.tox
View
51 tools/test-installed-la.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+from __future__ import division
+
+# This file is a modified version of the original numpy file:
+# test-installed-numpy.py
+
+# A simple script to test the installed version of la by calling
+# 'la.test()'. Key features:
+# -- convenient command-line syntax
+# -- sets exit status appropriately, useful for automated test environments
+
+# It would be better to set this up as a module in the la namespace, so
+# that it could be run as:
+# python -m la.run_tests <args>
+# But, python2.4's -m switch only works with top-level modules, not modules
+# that are inside packages. So, once we drop 2.4 support, maybe...
+# TODO: la doesn't support python 2.4
+
+import sys
+# In case we are run from the source directory, we don't want to import
+# bottleneck from there, we want to import the installed version:
+sys.path.pop(0)
+
+from optparse import OptionParser
+parser = OptionParser("usage: %prog [options] -- [nosetests options]")
+parser.add_option("-v", "--verbose",
+ action="count", dest="verbose", default=1,
+ help="increase verbosity")
+parser.add_option("--doctests",
+ action="store_true", dest="doctests", default=False,
+ help="Run doctests in module")
+parser.add_option("--coverage",
+ action="store_true", dest="coverage", default=False,
+ help="report coverage of NumPy code (requires 'coverage' module")
+parser.add_option("-m", "--mode",
+ action="store", dest="mode", default="fast",
+ help="'fast', 'full', or something that could be "
+ "passed to nosetests -A [default: %default]")
+(options, args) = parser.parse_args()
+
+import la
+result = la.test(options.mode,
+ verbose=options.verbose,
+ extra_argv=args,
+ doctests=options.doctests,
+ coverage=options.coverage)
+
+if result.wasSuccessful():
+ sys.exit(0)
+else:
+ sys.exit(1)
View
36 tox.ini
@@ -0,0 +1,36 @@
+# Tox (http://tox.testrun.org/) configuration
+
+[tox]
+envlist = py27_np151, py27_np162, py27_np170
+
+[testenv]
+changedir={envdir}
+commands=
+ pip install Bottleneck
+ pip install h5py
+ {envpython} {toxinidir}/tools/test-installed-la.py {posargs:}
+
+[testenv:py27_np151]
+basepython = python2.7
+deps =
+ nose
+ numpy==1.5.1
+
+[testenv:py27_np162]
+basepython = python2.7
+deps =
+ nose
+ numpy==1.6.2
+
+[testenv:py27_np170]
+basepython = python2.7
+deps =
+ nose
+ numpy==1.7.0
+
+# Not run by default. Use 'tox -e py27_npmaster' to call it
+[testenv:py27_npmaster]
+basepython = python2.7
+deps =
+ nose
+ https://github.com/numpy/numpy/zipball/master

0 comments on commit 93aa17f

Please sign in to comment.
Something went wrong with that request. Please try again.