Skip to content

Commit ce036a9

Browse files
rgommerscharris
authored andcommitted
TST: fix distutils tests for deprecations in recent setuptools versions
Closes numpygh-24350 [skip circle] [skip travis]
1 parent 50f4c6a commit ce036a9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎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 issues.
20+
# 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)