diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2021-10-09 14:33:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-09 14:33:10 -0600 |
commit | 83d8df9cdda474c51d18569bae8ad02ccf4d8411 (patch) | |
tree | 24678fcd34e1282dda47f04644627914f6c3804e /numpy/tests | |
parent | 6217121f258e38312b61cc5247cf3ed7d868047f (diff) | |
parent | b3dbd784014a22a95163c5b8c80ab3fe40e96ec7 (diff) | |
download | numpy-83d8df9cdda474c51d18569bae8ad02ccf4d8411.tar.gz |
Merge pull request #17530 from BvB93/fspath
ENH: Allow `ctypeslib.load_library` to take any path-like object
Diffstat (limited to 'numpy/tests')
-rw-r--r-- | numpy/tests/test_ctypeslib.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/numpy/tests/test_ctypeslib.py b/numpy/tests/test_ctypeslib.py index af3730df1..1ea083700 100644 --- a/numpy/tests/test_ctypeslib.py +++ b/numpy/tests/test_ctypeslib.py @@ -1,6 +1,7 @@ import sys import pytest import weakref +from pathlib import Path import numpy as np from numpy.ctypeslib import ndpointer, load_library, as_array @@ -37,13 +38,15 @@ else: reason="Known to fail on cygwin") class TestLoadLibrary: def test_basic(self): - try: - # Should succeed - load_library('_multiarray_umath', np.core._multiarray_umath.__file__) - except ImportError as e: - msg = ("ctypes is not available on this python: skipping the test" - " (import error was: %s)" % str(e)) - print(msg) + loader_path = np.core._multiarray_umath.__file__ + + out1 = load_library('_multiarray_umath', loader_path) + out2 = load_library(Path('_multiarray_umath'), loader_path) + out3 = load_library('_multiarray_umath', Path(loader_path)) + out4 = load_library(b'_multiarray_umath', loader_path) + + assert isinstance(out1, ctypes.CDLL) + assert out1 is out2 is out3 is out4 def test_basic2(self): # Regression for #801: load_library with a full library name |