8000 Merge pull request #24354 from rgommers/py311-tests · numpy/numpy@9efd68c · GitHub
[go: up one dir, main page]

Skip to content

Commit 9efd68c

Browse files
authored
Merge pull request #24354 from rgommers/py311-tests
TST: fix distutils tests for deprecations in recent setuptools versions
2 parents 3b99af4 + 240f389 commit 9efd68c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

numpy/distutils/tests/test_system_info.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44
from tempfile import mkstemp, mkdtemp
55
from subprocess import Popen, PIPE
6+
import importlib.metadata
67
from distutils.errors import DistutilsError
78

89
from numpy.testing import assert_, assert_equal, assert_raises
@@ -13,6 +14,16 @@
1314
from numpy.distutils import _shell_utils
1415

1516

17+
try:
18+
if importlib.metadata.version('setuptools') >= '60':
19+
# pkg-resources gives deprecation warnings, and there may be more
20+
# issues. We only support setuptools <60
21+
pytest.skip("setuptools is too new", allow_module_level=True)
22+
except importlib.metadata.PackageNotFoundError:
23+
# we don't require `setuptools`; if it is not found, continue
24+
pass
25+
26+
1627
def get_class(name, notfound_action=1):
1728
"""
1829
notfound_action:

0 commit comments

Comments
 (0)
0