diff options
-rw-r--r-- | .circleci/config.yml | 2 | ||||
-rw-r--r-- | azure-pipelines.yml | 56 | ||||
-rw-r--r-- | doc/release/1.16.0-notes.rst | 6 | ||||
-rw-r--r-- | numpy/core/_internal.py | 3 | ||||
-rw-r--r-- | numpy/core/einsumfunc.py | 2 | ||||
-rw-r--r-- | numpy/core/overrides.py | 97 | ||||
-rw-r--r-- | numpy/core/src/multiarray/convert_datatype.c | 19 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 4 | ||||
-rw-r--r-- | numpy/core/tests/test_numeric.py | 2 | ||||
-rwxr-xr-x | numpy/f2py/crackfortran.py | 4 | ||||
-rw-r--r-- | numpy/f2py/tests/test_array_from_pyobj.py | 2 | ||||
-rw-r--r-- | numpy/f2py/tests/test_semicolon_split.py | 7 | ||||
-rw-r--r-- | numpy/lib/function_base.py | 44 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 52 | ||||
-rw-r--r-- | numpy/testing/decorators.py | 4 | ||||
-rw-r--r-- | numpy/testing/noseclasses.py | 4 | ||||
-rw-r--r-- | numpy/testing/nosetester.py | 4 | ||||
-rw-r--r-- | numpy/testing/utils.py | 4 | ||||
-rw-r--r-- | numpy/tests/test_scripts.py | 1 |
19 files changed, 253 insertions, 64 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 906e96a83..9e227ab35 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ jobs: command: | python3 -m venv venv . venv/bin/activate - pip install cython sphinx matplotlib + pip install cython sphinx==1.7.9 matplotlib sudo apt-get update sudo apt-get install -y graphviz texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra texlive-generic-extra latexmk texlive-xetex diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..fe643370d --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,56 @@ +jobs: +- job: macOS + pool: + # NOTE: at time of writing, there is a danger + # that using an invalid vmIMage string for macOS + # image silently redirects to a Windows build on Azure; + # for now, use the only image name officially present in + # the docs even though i.e., numba uses another in their + # azure config for mac os -- Microsoft has indicated + # they will patch this issue + vmIMage: macOS-10.13 + steps: + # the @0 refers to the (major) version of the *task* on Microsoft's + # end, not the order in the build matrix nor anything to do + # with version of Python selected + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.6' + addToPath: true + architecture: 'x64' + # NOTE: do we have a compelling reason to use older / newer + # versions of Xcode toolchain for testing? + - script: /bin/bash -c "sudo xcode-select -s /Applications/Xcode_10.app/Contents/Developer" + displayName: 'select Xcode version' + # NOTE: might be better if we could avoid installing + # two C compilers, but with homebrew looks like we're + # now stuck getting the full gcc toolchain instead of + # just pulling in gfortran + - script: brew install gcc + displayName: 'make gfortran available on mac os vm' + - script: python -m pip install --upgrade pip setuptools wheel + displayName: 'Install tools' + - script: python -m pip install cython nose pytest-xdist pytz + displayName: 'Install dependencies; some are optional to avoid test skips' + # NOTE: init_dgelsd failed init issue with current ACCELERATE / + # LAPACK configuration on Azure macos image; at the time of writing + # this plagues homebrew / macports NumPy builds, but we will + # circumvent for now by aggressively disabling acceleration for + # macos NumPy builds / tests; ACCELERATE=None on its own is not + # sufficient + # also, might as well prefer usage of clang over gcc proper + # to match likely scenario on many user mac machines + - script: python setup.py build -j 4 install + displayName: 'Build NumPy' + env: + BLAS: None + LAPACK: None + ATLAS: None + ACCELERATE: None + CC: /usr/bin/clang + - script: python runtests.py --mode=full -- -n auto -rsx --junitxml=junit/test-results.xml + displayName: 'Run Full NumPy Test Suite' + - task: PublishTestResults@2 + inputs: + testResultsFiles: '**/test-*.xml' + testRunTitle: 'Publish test results for Python $(python.version)' diff --git a/doc/release/1.16.0-notes.rst b/doc/release/1.16.0-notes.rst index 2b84bb90a..6a73ed354 100644 --- a/doc/release/1.16.0-notes.rst +++ b/doc/release/1.16.0-notes.rst @@ -107,6 +107,12 @@ Previously, a ``LinAlgError`` would be raised when an empty matrix/empty matrices (with zero rows and/or columns) is/are passed in. Now outputs of appropriate shapes are returned. +``np.diff`` Added kwargs prepend and append +------------------------------------------- +Add kwargs prepend and append, allowing for values to be inserted +on either end of the differences. Similar to options for ediff1d. +Allows for the inverse of cumsum easily via prepend=0 + ARM support updated ------------------- Support for ARM CPUs has been updated to accommodate 32 and 64 bit targets, diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py index 9b8f5aef3..c4d967dc2 100644 --- a/numpy/core/_internal.py +++ b/numpy/core/_internal.py @@ -9,13 +9,12 @@ from __future__ import division, absolute_import, print_function import re import sys -from numpy.compat import basestring, unicode +from numpy.compat import unicode from .multiarray import dtype, array, ndarray try: import ctypes except ImportError: ctypes = None -from .numerictypes import object_ if (sys.byteorder == 'little'): _nbo = b'<' diff --git a/numpy/core/einsumfunc.py b/numpy/core/einsumfunc.py index a42e15b85..1281b3c98 100644 --- a/numpy/core/einsumfunc.py +++ b/numpy/core/einsumfunc.py @@ -8,7 +8,7 @@ import itertools from numpy.compat import basestring from numpy.core.multiarray import c_einsum -from numpy.core.numeric import asarray, asanyarray, result_type, tensordot, dot +from numpy.core.numeric import asanyarray, tensordot __all__ = ['einsum', 'einsum_path'] diff --git a/numpy/core/overrides.py b/numpy/core/overrides.py index c1d5e3864..17e3d475f 100644 --- a/numpy/core/overrides.py +++ b/numpy/core/overrides.py @@ -12,14 +12,28 @@ _NDARRAY_ARRAY_FUNCTION = ndarray.__array_function__ def get_overloaded_types_and_args(relevant_args): """Returns a list of arguments on which to call __array_function__. - __array_function__ implementations should be called in order on the return - values from this function. + Parameters + ---------- + relevant_args : iterable of array-like + Iterable of array-like arguments to check for __array_function__ + methods. + + Returns + ------- + overloaded_types : collection of types + Types of arguments from relevant_args with __array_function__ methods. + overloaded_args : list + Arguments from relevant_args on which to call __array_function__ + methods, in the order in which they should be called. """ # Runtime is O(num_arguments * num_unique_types) overloaded_types = [] overloaded_args = [] for arg in relevant_args: arg_type = type(arg) + # We only collect arguments if they have a unique type, which ensures + # reasonable performance even with a long list of possibly overloaded + # arguments. if (arg_type not in overloaded_types and hasattr(arg_type, '__array_function__')): @@ -35,7 +49,7 @@ def get_overloaded_types_and_args(relevant_args): break overloaded_args.insert(index, arg) - # Special handling for ndarray. + # Special handling for ndarray.__array_function__ overloaded_args = [ arg for arg in overloaded_args if type(arg).__array_function__ is not _NDARRAY_ARRAY_FUNCTION @@ -44,43 +58,62 @@ def get_overloaded_types_and_args(relevant_args): return overloaded_types, overloaded_args -def array_function_override(overloaded_args, func, types, args, kwargs): - """Call __array_function__ implementations.""" +def array_function_implementation_or_override( + implementation, public_api, relevant_args, args, kwargs): + """Implement a function with checks for __array_function__ overrides. + + Arguments + --------- + implementation : function + Function that implements the operation on NumPy array without + overrides when called like ``implementation(*args, **kwargs)``. + public_api : function + Function exposed by NumPy's public API riginally called like + ``public_api(*args, **kwargs`` on which arguments are now being + checked. + relevant_args : iterable + Iterable of arguments to check for __array_function__ methods. + args : tuple + Arbitrary positional arguments originally passed into ``public_api``. + kwargs : tuple + Arbitrary keyword arguments originally passed into ``public_api``. + + Returns + ------- + Result from calling `implementation()` or an `__array_function__` + method, as appropriate. + + Raises + ------ + TypeError : if no implementation is found. + """ + # Check for __array_function__ methods. + types, overloaded_args = get_overloaded_types_and_args(relevant_args) + if not overloaded_args: + return implementation(*args, **kwargs) + + # Call overrides for overloaded_arg in overloaded_args: - # Note that we're only calling __array_function__ on the *first* - # occurence of each argument type. This is necessary for reasonable - # performance with a possibly long list of overloaded arguments, for - # which each __array_function__ implementation might reasonably need to - # check all argument types. - result = overloaded_arg.__array_function__(func, types, args, kwargs) + # Use `public_api` instead of `implemenation` so __array_function__ + # implementations can do equality/identity comparisons. + result = overloaded_arg.__array_function__( + public_api, types, args, kwargs) if result is not NotImplemented: return result raise TypeError('no implementation found for {} on types that implement ' '__array_function__: {}' - .format(func, list(map(type, overloaded_args)))) + .format(public_api, list(map(type, overloaded_args)))) def array_function_dispatch(dispatcher): - """Wrap a function for dispatch with the __array_function__ protocol.""" - def decorator(func): - @functools.wraps(func) - def new_func(*args, **kwargs): - # Collect array-like arguments. - relevant_arguments = dispatcher(*args, **kwargs) - # Check for __array_function__ methods. - types, overloaded_args = get_overloaded_types_and_args( - relevant_arguments) - # Call overrides, if necessary. - if overloaded_args: - # new_func is the function exposed in NumPy's public API. We - # use it instead of func so __array_function__ implementations - # can do equality/identity comparisons. - return array_function_override( - overloaded_args, new_func, types, args, kwargs) - else: - return func(*args, **kwargs) - - return new_func + """Decorator for adding dispatch with the __array_function__ protocol.""" + def decorator(implementation): + @functools.wraps(implementation) + def public_api(*args, **kwargs): + relevant_args = dispatcher(*args, **kwargs) + return array_function_implementation_or_override( + implementation, public_api, relevant_args, args, kwargs) + return public_api return decorator diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c index 3df764a48..33a706412 100644 --- a/numpy/core/src/multiarray/convert_datatype.c +++ b/numpy/core/src/multiarray/convert_datatype.c @@ -2028,7 +2028,6 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) { int i, n, allscalars = 0; PyArrayObject **mps = NULL; - PyObject *otmp; PyArray_Descr *intype = NULL, *stype = NULL; PyArray_Descr *newtype = NULL; NPY_SCALARKIND scalarkind = NPY_NOSCALAR, intypekind = NPY_NOSCALAR; @@ -2067,9 +2066,13 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) } for (i = 0; i < n; i++) { - otmp = PySequence_GetItem(op, i); + PyObject *otmp = PySequence_GetItem(op, i); + if (otmp == NULL) { + goto fail; + } if (!PyArray_CheckAnyScalar(otmp)) { newtype = PyArray_DescrFromObject(otmp, intype); + Py_DECREF(otmp); Py_XDECREF(intype); if (newtype == NULL) { goto fail; @@ -2079,6 +2082,7 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) } else { newtype = PyArray_DescrFromObject(otmp, stype); + Py_DECREF(otmp); Py_XDECREF(stype); if (newtype == NULL) { goto fail; @@ -2088,7 +2092,6 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) mps[i] = (PyArrayObject *)Py_None; Py_INCREF(Py_None); } - Py_XDECREF(otmp); } if (intype == NULL) { /* all scalars */ @@ -2112,6 +2115,9 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) newtype = PyArray_PromoteTypes(intype, stype); Py_XDECREF(intype); intype = newtype; + if (newtype == NULL) { + goto fail; + } } for (i = 0; i < n; i++) { Py_XDECREF(mps[i]); @@ -2123,8 +2129,9 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) /* Make sure all arrays are actual array objects. */ for (i = 0; i < n; i++) { int flags = NPY_ARRAY_CARRAY; + PyObject *otmp = PySequence_GetItem(op, i); - if ((otmp = PySequence_GetItem(op, i)) == NULL) { + if (otmp == NULL) { goto fail; } if (!allscalars && ((PyObject *)(mps[i]) == Py_None)) { @@ -2133,8 +2140,8 @@ PyArray_ConvertToCommonType(PyObject *op, int *retn) Py_DECREF(Py_None); } Py_INCREF(intype); - mps[i] = (PyArrayObject*) - PyArray_FromAny(otmp, intype, 0, 0, flags, NULL); + mps[i] = (PyArrayObject*)PyArray_FromAny(otmp, intype, 0, 0, + flags, NULL); Py_DECREF(otmp); if (mps[i] == NULL) { goto fail; diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 277f64a5d..6fbdb7c6c 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -1416,6 +1416,10 @@ class TestMethods(object): A = ind.choose((x, y2)) assert_equal(A, [[2, 2, 3], [2, 2, 3]]) + oned = np.ones(1) + # gh-12031, caused SEGFAULT + assert_raises(TypeError, oned.choose,np.void(0), [oned]) + def test_prod(self): ba = [1, 2, 10, 11, 6, 5, 4] ba2 = [[1, 2, 3, 4], [5, 6, 7, 9], [10, 3, 4, 5]] diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index 7e2d6d1d1..f264c4ab0 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -13,7 +13,7 @@ from numpy.random import rand, randint, randn from numpy.testing import ( assert_, assert_equal, assert_raises, assert_raises_regex, assert_array_equal, assert_almost_equal, assert_array_almost_equal, - assert_raises, suppress_warnings, HAS_REFCOUNT + suppress_warnings, HAS_REFCOUNT ) diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py index 99ff030e3..361203a57 100755 --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -33,7 +33,7 @@ Note: f2py directive: <commentchar>f2py<line> is read as <line> Note: pythonmodule is introduced to represent Python module Usage: - `postlist=crackfortran(files,funcs)` + `postlist=crackfortran(files)` `postlist` contains declaration information read from the list of files `files`. `crack2fortran(postlist)` returns a fortran code to be saved to pyf-file @@ -3341,7 +3341,7 @@ if __name__ == "__main__": and also be sure that the files do not contain programs without program statement). """, 0) - postlist = crackfortran(files, funcs) + postlist = crackfortran(files) if pyffilename: outmess('Writing fortran code to file %s\n' % repr(pyffilename), 0) pyf = crack2fortran(postlist) diff --git a/numpy/f2py/tests/test_array_from_pyobj.py b/numpy/f2py/tests/test_array_from_pyobj.py index 6b244611c..a80090185 100644 --- a/numpy/f2py/tests/test_array_from_pyobj.py +++ b/numpy/f2py/tests/test_array_from_pyobj.py @@ -5,8 +5,6 @@ import sys import copy import pytest -import pytest - from numpy import ( array, alltrue, ndarray, zeros, dtype, intp, clongdouble ) diff --git a/numpy/f2py/tests/test_semicolon_split.py b/numpy/f2py/tests/test_semicolon_split.py index 2b0f32727..5452b5708 100644 --- a/numpy/f2py/tests/test_semicolon_split.py +++ b/numpy/f2py/tests/test_semicolon_split.py @@ -1,5 +1,8 @@ from __future__ import division, absolute_import, print_function +import platform +import pytest + from . import util from numpy.testing import assert_equal @@ -23,6 +26,10 @@ void foo(int* x) {{ end python module {module} """.format(module=module_name) + @pytest.mark.skipif(platform.system() == 'Darwin', + reason="Prone to error when run with " + "numpy/f2py/tests on mac os, " + "but not when run in isolation") def test_multiline(self): assert_equal(self.module.foo(), 42) diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 2992e92bb..e2a8f4bc2 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -9,24 +9,23 @@ except ImportError: import re import sys import warnings -import operator import numpy as np import numpy.core.numeric as _nx -from numpy.core import linspace, atleast_1d, atleast_2d, transpose +from numpy.core import atleast_1d, transpose from numpy.core.numeric import ( ones, zeros, arange, concatenate, array, asarray, asanyarray, empty, empty_like, ndarray, around, floor, ceil, take, dot, where, intp, - integer, isscalar, absolute, AxisError + integer, isscalar, absolute ) from numpy.core.umath import ( - pi, multiply, add, arctan2, frompyfunc, cos, less_equal, sqrt, sin, - mod, exp, log10, not_equal, subtract + pi, add, arctan2, frompyfunc, cos, less_equal, sqrt, sin, + mod, exp, not_equal, subtract ) from numpy.core.fromnumeric import ( - ravel, nonzero, sort, partition, mean, any, sum + ravel, nonzero, partition, mean, any, sum ) -from numpy.core.numerictypes import typecodes, number +from numpy.core.numerictypes import typecodes from numpy.core.function_base import add_newdoc from numpy.lib.twodim_base import diag from .utils import deprecate @@ -36,7 +35,6 @@ from numpy.core.multiarray import ( ) from numpy.core.umath import _add_newdoc_ufunc as add_newdoc_ufunc from numpy.compat import long -from numpy.compat.py3k import basestring if sys.version_info[0] < 3: # Force range to be a generator, for np.delete's usage. @@ -1090,7 +1088,7 @@ def gradient(f, *varargs, **kwargs): return outvals -def diff(a, n=1, axis=-1): +def diff(a, n=1, axis=-1, prepend=np._NoValue, append=np._NoValue): """ Calculate the n-th discrete difference along the given axis. @@ -1108,6 +1106,12 @@ def diff(a, n=1, axis=-1): axis : int, optional The axis along which the difference is taken, default is the last axis. + prepend, append : array_like, optional + Values to prepend or append to "a" along axis prior to + performing the difference. Scalar values are expanded to + arrays with length 1 in the direction of axis and the shape + of the input array in along all other axes. Otherwise the + dimension and shape must match "a" except along axis. Returns ------- @@ -1176,6 +1180,28 @@ def diff(a, n=1, axis=-1): nd = a.ndim axis = normalize_axis_index(axis, nd) + combined = [] + if prepend is not np._NoValue: + prepend = np.asanyarray(prepend) + if prepend.ndim == 0: + shape = list(a.shape) + shape[axis] = 1 + prepend = np.broadcast_to(prepend, tuple(shape)) + combined.append(prepend) + + combined.append(a) + + if append is not np._NoValue: + append = np.asanyarray(append) + if append.ndim == 0: + shape = list(a.shape) + shape[axis] = 1 + append = np.broadcast_to(append, tuple(shape)) + combined.append(append) + + if len(combined) > 1: + a = np.concatenate(combined, axis) + slice1 = [slice(None)] * nd slice2 = [slice(None)] * nd slice1[axis] = slice(1, None) diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index d5faed6ae..40cca1dbb 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -734,6 +734,58 @@ class TestDiff(object): assert_array_equal(out3.mask, [[], [], [], [], []]) assert_(type(out3) is type(x)) + def test_prepend(self): + x = np.arange(5) + 1 + assert_array_equal(diff(x, prepend=0), np.ones(5)) + assert_array_equal(diff(x, prepend=[0]), np.ones(5)) + assert_array_equal(np.cumsum(np.diff(x, prepend=0)), x) + assert_array_equal(diff(x, prepend=[-1, 0]), np.ones(6)) + + x = np.arange(4).reshape(2, 2) + result = np.diff(x, axis=1, prepend=0) + expected = [[0, 1], [2, 1]] + assert_array_equal(result, expected) + result = np.diff(x, axis=1, prepend=[[0], [0]]) + assert_array_equal(result, expected) + + result = np.diff(x, axis=0, prepend=0) + expected = [[0, 1], [2, 2]] + assert_array_equal(result, expected) + result = np.diff(x, axis=0, prepend=[[0, 0]]) + assert_array_equal(result, expected) + + assert_raises(ValueError, np.diff, x, prepend=np.zeros((3,3))) + + assert_raises(np.AxisError, diff, x, prepend=0, axis=3) + + def test_append(self): + x = np.arange(5) + result = diff(x, append=0) + expected = [1, 1, 1, 1, -4] + assert_array_equal(result, expected) + result = diff(x, append=[0]) + assert_array_equal(result, expected) + result = diff(x, append=[0, 2]) + expected = expected + [2] + assert_array_equal(result, expected) + + x = np.arange(4).reshape(2, 2) + result = np.diff(x, axis=1, append=0) + expected = [[1, -1], [1, -3]] + assert_array_equal(result, expected) + result = np.diff(x, axis=1, append=[[0], [0]]) + assert_array_equal(result, expected) + + result = np.diff(x, axis=0, append=0) + expected = [[2, 2], [-2, -3]] + assert_array_equal(result, expected) + result = np.diff(x, axis=0, append=[[0, 0]]) + assert_array_equal(result, expected) + + assert_raises(ValueError, np.diff, x, append=np.zeros((3,3))) + + assert_raises(np.AxisError, diff, x, append=0, axis=3) + class TestDelete(object): diff --git a/numpy/testing/decorators.py b/numpy/testing/decorators.py index 68c1554b5..bf78be500 100644 --- a/numpy/testing/decorators.py +++ b/numpy/testing/decorators.py @@ -8,8 +8,8 @@ from __future__ import division, absolute_import, print_function import warnings # 2018-04-04, numpy 1.15.0 -warnings.warn("Importing from numpy.testing.decorators is deprecated, " - "import from numpy.testing instead.", +warnings.warn("Importing from numpy.testing.decorators is deprecated " + "since numpy 1.15.0, import from numpy.testing instead.", DeprecationWarning, stacklevel=2) from ._private.decorators import * diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py index e0e728a32..5748a9a0f 100644 --- a/numpy/testing/noseclasses.py +++ b/numpy/testing/noseclasses.py @@ -7,8 +7,8 @@ from __future__ import division, absolute_import, print_function import warnings # 2018-04-04, numpy 1.15.0 -warnings.warn("Importing from numpy.testing.noseclasses is deprecated, " - "import from numpy.testing instead", +warnings.warn("Importing from numpy.testing.noseclasses is deprecated " + "since 1.15.0, import from numpy.testing instead", DeprecationWarning, stacklevel=2) from ._private.noseclasses import * diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py index c8c7d6e68..2ac212eee 100644 --- a/numpy/testing/nosetester.py +++ b/numpy/testing/nosetester.py @@ -8,8 +8,8 @@ from __future__ import division, absolute_import, print_function import warnings # 2018-04-04, numpy 1.15.0 -warnings.warn("Importing from numpy.testing.nosetester is deprecated, " - "import from numpy.testing instead.", +warnings.warn("Importing from numpy.testing.nosetester is deprecated " + "since 1.15.0, import from numpy.testing instead.", DeprecationWarning, stacklevel=2) from ._private.nosetester import * diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index 184adcc74..98f19e348 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -8,8 +8,8 @@ from __future__ import division, absolute_import, print_function import warnings # 2018-04-04, numpy 1.15.0 -warnings.warn("Importing from numpy.testing.utils is deprecated, " - "import from numpy.testing instead.", +warnings.warn("Importing from numpy.testing.utils is deprecated " + "since 1.15.0, import from numpy.testing instead.", ImportWarning, stacklevel=2) from ._private.utils import * diff --git a/numpy/tests/test_scripts.py b/numpy/tests/test_scripts.py index 26e3ea745..33210cc42 100644 --- a/numpy/tests/test_scripts.py +++ b/numpy/tests/test_scripts.py @@ -60,6 +60,7 @@ def run_command(cmd, check_code=True): @pytest.mark.skipif(is_inplace, reason="Cannot test f2py command inplace") +@pytest.mark.xfail(reason="Test is unreliable") def test_f2py(): # test that we can run f2py script |