summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/tests/test_multiarray.py11
-rw-r--r--numpy/core/tests/test_regression.py5
-rw-r--r--numpy/f2py/tests/util.py5
3 files changed, 3 insertions, 18 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 829679dab..7b3397795 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -16,14 +16,7 @@ from contextlib import contextmanager
from numpy.compat import pickle
-try:
- import pathlib
-except ImportError:
- try:
- import pathlib2 as pathlib
- except ImportError:
- pathlib = None
-
+import pathlib
import builtins
from decimal import Decimal
@@ -4680,14 +4673,12 @@ class TestIO:
y = np.fromfile(self.filename, dtype=self.dtype)
assert_array_equal(y, self.x.flat)
- @pytest.mark.skipif(pathlib is None, reason="pathlib not found")
def test_roundtrip_pathlib(self):
p = pathlib.Path(self.filename)
self.x.tofile(p)
y = np.fromfile(p, dtype=self.dtype)
assert_array_equal(y, self.x.flat)
- @pytest.mark.skipif(pathlib is None, reason="pathlib not found")
def test_roundtrip_dump_pathlib(self):
p = pathlib.Path(self.filename)
self.x.dump(p)
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 06c7ff0b8..0cb1207d9 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -1506,10 +1506,7 @@ class TestRegression:
test_type(t)
def test_buffer_hashlib(self):
- try:
- from hashlib import md5
- except ImportError:
- from md5 import new as md5
+ from hashlib import md5
x = np.array([1, 2, 3], dtype=np.dtype('<i4'))
assert_equal(md5(x).hexdigest(), '2a1dd1e1e59d0a384c26951e316cd7e6')
diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py
index 6dcc2ed12..c5b06697d 100644
--- a/numpy/f2py/tests/util.py
+++ b/numpy/f2py/tests/util.py
@@ -19,10 +19,7 @@ from numpy.compat import asbytes, asstr
from numpy.testing import temppath
from importlib import import_module
-try:
- from hashlib import md5
-except ImportError:
- from md5 import new as md5 # noqa: F401
+from hashlib import md5
#
# Maintaining a temporary module directory