diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py index 66304a5e50fe..9bcc09050503 100644 --- a/numpy/distutils/tests/test_system_info.py +++ b/numpy/distutils/tests/test_system_info.py @@ -3,6 +3,7 @@ import pytest from tempfile import mkstemp, mkdtemp from subprocess import Popen, PIPE +import importlib.metadata from distutils.errors import DistutilsError from numpy.testing import assert_, assert_equal, assert_raises @@ -13,6 +14,16 @@ from numpy.distutils import _shell_utils +try: + if importlib.metadata.version('setuptools') >= '60': + # pkg-resources gives deprecation warnings, and there may be more + # issues. We only support setuptools <60 + pytest.skip("setuptools is too new", allow_module_level=True) +except importlib.metadata.PackageNotFoundError: + # we don't require `setuptools`; if it is not found, continue + pass + + def get_class(name, notfound_action=1): """ notfound_action: