From 89b62c58cc79e4fc1a3e018915ffc692c1d926b6 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Mon, 7 Aug 2023 11:58:16 +0200 Subject: [PATCH 1/2] TST: fix distutils tests for deprecations in recent setuptools versions Closes gh-24350 [skip circle] [skip travis] --- numpy/distutils/tests/test_system_info.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py index 66304a5e50fe..951ab8c1efca 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: From 8c84d42eb1e59569d057bdc723e285c6a387bd45 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Mon, 7 Aug 2023 08:32:33 -0600 Subject: [PATCH 2/2] MAINT: Fix long line --- numpy/distutils/tests/test_system_info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py index 951ab8c1efca..9bcc09050503 100644 --- a/numpy/distutils/tests/test_system_info.py +++ b/numpy/distutils/tests/test_system_info.py @@ -16,8 +16,8 @@ try: if importlib.metadata.version('setuptools') >= '60': - # pkg-resources gives deprecation warnings, and there may be more issues. - # we only support 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