diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2018-04-02 15:48:20 -0600 |
|---|---|---|
| committer | Charles Harris <charlesr.harris@gmail.com> | 2018-04-04 06:40:28 -0600 |
| commit | cf46d8cd2aa809be44b684ba234880e0aa4befe9 (patch) | |
| tree | a088359008c9264d9ca6bbe7fe34c2c4440481a3 /numpy | |
| parent | 7e5a41de9fab731e27a761c01302a0a93e2d1070 (diff) | |
| download | numpy-cf46d8cd2aa809be44b684ba234880e0aa4befe9.tar.gz | |
TST: Update modules `test` to PytestTester.
Numpy can now be tested using the standard
`python -c"import numpy; numpy.test()"`
construct.
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/__init__.py | 20 | ||||
| -rw-r--r-- | numpy/core/__init__.py | 8 | ||||
| -rw-r--r-- | numpy/distutils/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/f2py/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/fft/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/lib/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/linalg/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/ma/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/matrixlib/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/polynomial/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/random/__init__.py | 5 | ||||
| -rw-r--r-- | numpy/testing/__init__.py | 6 |
12 files changed, 44 insertions, 35 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py index db7bc0368..d10a1ecd3 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -146,11 +146,6 @@ else: pkgload.__doc__ = PackageLoader.__call__.__doc__ - # We don't actually use this ourselves anymore, but I'm not 100% sure that - # no-one else in the world is using it (though I hope not) - from .testing import Tester, _numpy_tester - test = _numpy_tester().test - # Allow distributors to run custom init code from . import _distributor_init @@ -186,13 +181,16 @@ else: __all__.extend(lib.__all__) __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma']) - - # Filter annoying Cython warnings that serve no good purpose. - warnings.filterwarnings("ignore", message="numpy.dtype size changed") - warnings.filterwarnings("ignore", message="numpy.ufunc size changed") - warnings.filterwarnings("ignore", message="numpy.ndarray size changed") - # oldnumeric and numarray were removed in 1.9. In case some packages import # but do not use them, we define them here for backward compatibility. oldnumeric = 'removed' numarray = 'removed' + + # We don't actually use this ourselves anymore, but I'm not 100% sure that + # no-one else in the world is using it (though I hope not) + from .testing import Tester + + # Pytest testing + from numpy.testing._private.pytesttester import PytestTester + test = PytestTester(__name__) + del PytestTester diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py index 264324503..4d9cbf5da 100644 --- a/numpy/core/__init__.py +++ b/numpy/core/__init__.py @@ -70,10 +70,6 @@ __all__ += getlimits.__all__ __all__ += shape_base.__all__ __all__ += einsumfunc.__all__ - -from numpy.testing import _numpy_tester -test = _numpy_tester().test - # Make it possible so that ufuncs can be pickled # Here are the loading and unloading functions # The name numpy.core._ufunc_reconstruct must be @@ -103,3 +99,7 @@ copyreg.pickle(ufunc, _ufunc_reduce, _ufunc_reconstruct) del copyreg del sys del _ufunc_reduce + +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/distutils/__init__.py b/numpy/distutils/__init__.py index d5921b399..b794bebd7 100644 --- a/numpy/distutils/__init__.py +++ b/numpy/distutils/__init__.py @@ -17,8 +17,9 @@ try: # Normally numpy is installed if the above import works, but an interrupted # in-place build could also have left a __config__.py. In that case the # next import may still fail, so keep it inside the try block. - from numpy.testing import _numpy_tester - test = _numpy_tester().test + from numpy.testing._private.pytesttester import PytestTester + test = PytestTester(__name__) + del PytestTester except ImportError: pass diff --git a/numpy/f2py/__init__.py b/numpy/f2py/__init__.py index 86cc45b42..5075c682d 100644 --- a/numpy/f2py/__init__.py +++ b/numpy/f2py/__init__.py @@ -69,5 +69,6 @@ def compile(source, f.close() return status -from numpy.testing import _numpy_tester -test = _numpy_tester().test +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/fft/__init__.py b/numpy/fft/__init__.py index d1716bd4b..bbb6ec8c7 100644 --- a/numpy/fft/__init__.py +++ b/numpy/fft/__init__.py @@ -6,5 +6,6 @@ from .info import __doc__ from .fftpack import * from .helper import * -from numpy.testing import _numpy_tester -test = _numpy_tester().test +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/lib/__init__.py b/numpy/lib/__init__.py index 0c2e6dfab..d764cdc7e 100644 --- a/numpy/lib/__init__.py +++ b/numpy/lib/__init__.py @@ -46,5 +46,6 @@ __all__ += financial.__all__ __all__ += nanfunctions.__all__ __all__ += histograms.__all__ -from numpy.testing import _numpy_tester -test = _numpy_tester().test +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/linalg/__init__.py b/numpy/linalg/__init__.py index 1510a8448..37bd27574 100644 --- a/numpy/linalg/__init__.py +++ b/numpy/linalg/__init__.py @@ -50,5 +50,6 @@ from .info import __doc__ from .linalg import * -from numpy.testing import _numpy_tester -test = _numpy_tester().test +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/ma/__init__.py b/numpy/ma/__init__.py index 0689f2932..34f21b8b1 100644 --- a/numpy/ma/__init__.py +++ b/numpy/ma/__init__.py @@ -51,5 +51,6 @@ __all__ = ['core', 'extras'] __all__ += core.__all__ __all__ += extras.__all__ -from numpy.testing import _numpy_tester -test = _numpy_tester().test +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/matrixlib/__init__.py b/numpy/matrixlib/__init__.py index 95713580d..3ad3a9549 100644 --- a/numpy/matrixlib/__init__.py +++ b/numpy/matrixlib/__init__.py @@ -7,5 +7,6 @@ from .defmatrix import * __all__ = defmatrix.__all__ -from numpy.testing import _numpy_tester -test = _numpy_tester().test +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/polynomial/__init__.py b/numpy/polynomial/__init__.py index f7cbc19b0..c18bebedb 100644 --- a/numpy/polynomial/__init__.py +++ b/numpy/polynomial/__init__.py @@ -22,5 +22,6 @@ from .hermite import Hermite from .hermite_e import HermiteE from .laguerre import Laguerre -from numpy.testing import _numpy_tester -test = _numpy_tester().test +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/random/__init__.py b/numpy/random/__init__.py index 409f50ec0..81cb94cc1 100644 --- a/numpy/random/__init__.py +++ b/numpy/random/__init__.py @@ -117,5 +117,6 @@ def __RandomState_ctor(): """ return RandomState(seed=0) -from numpy.testing import _numpy_tester -test = _numpy_tester().test +from numpy.testing._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/numpy/testing/__init__.py b/numpy/testing/__init__.py index f4970b06b..a7c85931c 100644 --- a/numpy/testing/__init__.py +++ b/numpy/testing/__init__.py @@ -12,9 +12,11 @@ from unittest import TestCase from ._private.utils import * from ._private import decorators as dec from ._private.nosetester import ( - run_module_suite, NoseTester as Tester, _numpy_tester, + run_module_suite, NoseTester as Tester ) __all__ = _private.utils.__all__ + ['TestCase', 'run_module_suite'] -test = _numpy_tester().test +from ._private.pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester |
