summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-04-04 12:31:56 -0600
committerCharles Harris <charlesr.harris@gmail.com>2018-04-06 20:47:00 -0600
commitcf73c76d3078b30b521f8abd19ae7996987784f7 (patch)
treee2a891e0900724c16112182d6e859303add33d97
parent036151143bff1eebeded5582534e676a192352cd (diff)
downloadnumpy-cf73c76d3078b30b521f8abd19ae7996987784f7.tar.gz
DEP: Issue deprecation warnings for some imports.
The following modules have been moved or renamed and should not be imported. This adds shim modules for the old names that issue a DeprecationWarning on import. * numpy/core/umath_tests.py * numpy/testing/decorators.py * numpy/testing/noseclasses.py * numpy/testing/nosetester.py * numpy/testing/utils.py Closes #10845.
-rw-r--r--numpy/core/umath_tests.py15
-rw-r--r--numpy/testing/decorators.py8
-rw-r--r--numpy/testing/noseclasses.py9
-rw-r--r--numpy/testing/nosetester.py8
-rw-r--r--numpy/testing/utils.py8
5 files changed, 39 insertions, 9 deletions
diff --git a/numpy/core/umath_tests.py b/numpy/core/umath_tests.py
new file mode 100644
index 000000000..28e325b98
--- /dev/null
+++ b/numpy/core/umath_tests.py
@@ -0,0 +1,15 @@
+"""
+Shim for _umath_tests to allow a deprecation period for the new name.
+
+"""
+from __future__ import division, absolute_import, print_function
+
+import warnings
+
+# 2018-04-04, numpy 1.15.0
+warnings.warn(("numpy.core.umath_tests is an internal NumPy "
+ "module and should not be imported. It will "
+ "be removed in a future NumPy release."),
+ category=DeprecationWarning, stacklevel=2)
+
+from ._umath_tests import *
diff --git a/numpy/testing/decorators.py b/numpy/testing/decorators.py
index 1988afd29..68c1554b5 100644
--- a/numpy/testing/decorators.py
+++ b/numpy/testing/decorators.py
@@ -3,9 +3,13 @@ Back compatibility decorators module. It will import the appropriate
set of tools
"""
+from __future__ import division, absolute_import, print_function
+
import warnings
-warnings.warn("Import from numpy.testing, not numpy.testing.decorators",
- ImportWarning)
+# 2018-04-04, numpy 1.15.0
+warnings.warn("Importing from numpy.testing.decorators is deprecated, "
+ "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 dde62e825..e0e728a32 100644
--- a/numpy/testing/noseclasses.py
+++ b/numpy/testing/noseclasses.py
@@ -2,10 +2,13 @@
Back compatibility noseclasses module. It will import the appropriate
set of tools
"""
+from __future__ import division, absolute_import, print_function
+
import warnings
-warnings.warn("Import from numpy.testing, not numpy.testing.noseclasses",
- ImportWarning)
+# 2018-04-04, numpy 1.15.0
+warnings.warn("Importing from numpy.testing.noseclasses is deprecated, "
+ "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 772bff305..c8c7d6e68 100644
--- a/numpy/testing/nosetester.py
+++ b/numpy/testing/nosetester.py
@@ -3,10 +3,14 @@ Back compatibility nosetester module. It will import the appropriate
set of tools
"""
+from __future__ import division, absolute_import, print_function
+
import warnings
-warnings.warn("Import from numpy.testing, not numpy.testing.nosetester",
- ImportWarning)
+# 2018-04-04, numpy 1.15.0
+warnings.warn("Importing from numpy.testing.nosetester is deprecated, "
+ "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 3cd89e639..78cf405cf 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -3,10 +3,14 @@ Back compatibility utils module. It will import the appropriate
set of tools
"""
+from __future__ import division, absolute_import, print_function
+
import warnings
-warnings.warn("Import from numpy.testing, not numpy.testing.utils",
- ImportWarning)
+# 2018-04-04, numpy 1.15.0
+warnings.warn("Importing from numpy.testing.utils is deprecated, "
+ "import from numpy.testing instead.",
+ ImportWarning, stacklevel=2)
from ._private.utils import *