summaryrefslogtreecommitdiff
path: root/numpy/random/tests/test_extending.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/random/tests/test_extending.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/random/tests/test_extending.py')
-rw-r--r--numpy/random/tests/test_extending.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/random/tests/test_extending.py b/numpy/random/tests/test_extending.py
index 99a819efb..d362092b5 100644
--- a/numpy/random/tests/test_extending.py
+++ b/numpy/random/tests/test_extending.py
@@ -5,6 +5,7 @@ import subprocess
import sys
import warnings
import numpy as np
+from numpy.distutils.misc_util import exec_mod_from_location
try:
import cffi
@@ -75,10 +76,9 @@ def test_cython(tmp_path):
assert so1 is not None
assert so2 is not None
# import the so's without adding the directory to sys.path
- from importlib.machinery import ExtensionFileLoader
- extending = ExtensionFileLoader('extending', so1).load_module()
- extending_distributions = ExtensionFileLoader('extending_distributions', so2).load_module()
-
+ exec_mod_from_location('extending', so1)
+ extending_distributions = exec_mod_from_location(
+ 'extending_distributions', so2)
# actually test the cython c-extension
from numpy.random import PCG64
values = extending_distributions.uniforms_ex(PCG64(0), 10, 'd')