summaryrefslogtreecommitdiff
path: root/numpy/testing/_private/utils.py
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-11-19 14:51:36 +0200
committerGitHub <noreply@github.com>2021-11-19 07:51:36 -0500
commit46ec71f6bc74a0a248036b305fade5562e396c52 (patch)
treefbcdee4e3a86f8fcdfbee6269218fff01826a8c6 /numpy/testing/_private/utils.py
parent3774a620f79c069173d2567f09a9760f8ba0d564 (diff)
downloadnumpy-46ec71f6bc74a0a248036b305fade5562e396c52.tar.gz
ENH: provide a convenience function to replace npy_load_module (#20395)
`load_module` is deprecated since python 3.4 and will be removed in python 3.12. Use `exec_module` instead. Provide a convenience function in `distutils.misc_utils` instead of `npy_load_module` from `compat.py3k`.
Diffstat (limited to 'numpy/testing/_private/utils.py')
-rw-r--r--numpy/testing/_private/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py
index 4c6b64bc9..0eb945d15 100644
--- a/numpy/testing/_private/utils.py
+++ b/numpy/testing/_private/utils.py
@@ -1228,13 +1228,13 @@ def rundocs(filename=None, raise_on_error=True):
>>> np.lib.test(doctests=True) # doctest: +SKIP
"""
- from numpy.compat import npy_load_module
+ from numpy.distutils.misc_util import exec_mod_from_location
import doctest
if filename is None:
f = sys._getframe(1)
filename = f.f_globals['__file__']
name = os.path.splitext(os.path.basename(filename))[0]
- m = npy_load_module(name, filename)
+ m = exec_mod_from_location(name, filename)
tests = doctest.DocTestFinder().find(m)
runner = doctest.DocTestRunner(verbose=False)