Skip to content

Commit

Permalink
TST: pass sys.argv to run_module_suite by default
Browse files Browse the repository at this point in the history
allows passing flags like --pdb to test files
also add call to files where its missing
  • Loading branch information
juliantaylor committed Sep 4, 2014
1 parent 03dcd3b commit 949daea
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 12 deletions.
6 changes: 5 additions & 1 deletion numpy/compat/tests/test_compat.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from os.path import join

from numpy.compat import isfileobj
from numpy.testing import assert_
from numpy.testing import assert_, run_module_suite
from numpy.testing.utils import tempdir


Expand All @@ -17,3 +17,7 @@ def test_isfileobj():

with open(filename, 'rb') as f:
assert_(isfileobj(f))


if __name__ == "__main__":
run_module_suite()
6 changes: 4 additions & 2 deletions numpy/core/tests/test_abc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import division, absolute_import, print_function

import numpy as np
from numpy.testing import TestCase, assert_
from numpy.testing import TestCase, assert_, run_module_suite

import numbers
from numpy.core.numerictypes import sctypes
Expand Down Expand Up @@ -43,3 +42,6 @@ def test_uint(self):
assert_(issubclass(t, numbers.Integral),
"{0} is not subclass of Integral".format(t.__name__))


if __name__ == "__main__":
run_module_suite()
7 changes: 6 additions & 1 deletion numpy/core/tests/test_blasdot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import sys
from numpy.core import zeros, float64
from numpy.testing import dec, TestCase, assert_almost_equal, assert_, \
assert_raises, assert_array_equal, assert_allclose, assert_equal
assert_raises, assert_array_equal, assert_allclose, assert_equal, \
run_module_suite
from numpy.core.multiarray import inner as inner_

DECPREC = 14
Expand Down Expand Up @@ -169,3 +170,7 @@ def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
assert_equal(c.dot(a), "A")
assert_raises(TypeError, np.dot, b, c)
assert_raises(TypeError, c.dot, b)


if __name__ == "__main__":
run_module_suite()
6 changes: 5 additions & 1 deletion numpy/core/tests/test_function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,8 @@ def __rdiv__(self, x):

a = PhysicalQuantity(0.0)
b = PhysicalQuantity(1.0)
assert_equal(linspace(a, b), linspace(0.0, 1.0))
assert_equal(linspace(a, b), linspace(0.0, 1.0))


if __name__ == "__main__":
run_module_suite()
6 changes: 5 additions & 1 deletion numpy/core/tests/test_multiarray_assignment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import division, absolute_import, print_function

import numpy as np
from numpy.testing import TestCase
from numpy.testing import run_module_suite

ndims = 2
size = 10
Expand Down Expand Up @@ -78,3 +78,7 @@ def test_overlapping_assignments():
dstidx = tuple([a[1] for a in ind])

yield _check_assignment, srcidx, dstidx


if __name__ == "__main__":
run_module_suite()
8 changes: 5 additions & 3 deletions numpy/linalg/tests/test_build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from __future__ import division, absolute_import, print_function

from subprocess import call, PIPE, Popen
from subprocess import PIPE, Popen
import sys
import re

import numpy as np
from numpy.linalg import lapack_lite
from numpy.testing import TestCase, dec
from numpy.testing import TestCase, dec, run_module_suite

from numpy.compat import asbytes_nested

Expand Down Expand Up @@ -51,3 +50,6 @@ def test_lapack(self):
"""Both g77 and gfortran runtimes linked in lapack_lite ! This is likely to
cause random crashes and wrong results. See numpy INSTALL.txt for more
information.""")

if __name__ == "__main__":
run_module_suite()
3 changes: 3 additions & 0 deletions numpy/matrixlib/tests/test_multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ def test_keywords(self):

assert_(isinstance(y, np.matrix))
assert_equal(y.dtype, np.dtype('<i2'))

if __name__ == "__main__":
run_module_suite()
5 changes: 4 additions & 1 deletion numpy/matrixlib/tests/test_numeric.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from __future__ import division, absolute_import, print_function

from numpy.testing import assert_equal, TestCase
from numpy.testing import assert_equal, TestCase, run_module_suite
from numpy.core import ones
from numpy import matrix

class TestDot(TestCase):
def test_matscalar(self):
b1 = matrix(ones((3, 3), dtype=complex))
assert_equal(b1*1.0, b1)

if __name__ == "__main__":
run_module_suite()
3 changes: 3 additions & 0 deletions numpy/matrixlib/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ def test_matrix_std_argmax(self,level=rlevel):
x = np.asmatrix(np.random.uniform(0, 1, (3, 3)))
self.assertEqual(x.std().shape, ())
self.assertEqual(x.argmax().shape, ())

if __name__ == "__main__":
run_module_suite()
4 changes: 2 additions & 2 deletions numpy/testing/nosetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def run_module_suite(file_to_run=None, argv=None):
argv: list of strings
Arguments to be passed to the nose test runner. ``argv[0]`` is
ignored. All command line arguments accepted by ``nosetests``
will work.
will work. If it is the default value None, sys.argv is used.
.. versionadded:: 1.9.0
Expand All @@ -117,7 +117,7 @@ def run_module_suite(file_to_run=None, argv=None):
raise AssertionError

if argv is None:
argv = ['', file_to_run]
argv = sys.argv + [file_to_run]
else:
argv = argv + [file_to_run]

Expand Down

0 comments on commit 949daea

Please sign in to comment.