Skip to content

Commit 3bcf5ec

Browse files
Skip test_no_user_warning() without pip (#2487)
1 parent 3585f76 commit 3bcf5ec

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_manager.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import astroid
1818
from astroid import manager, test_utils
19-
from astroid.const import IS_JYTHON, IS_PYPY
19+
from astroid.const import IS_JYTHON, IS_PYPY, PY312_PLUS
2020
from astroid.exceptions import (
2121
AstroidBuildingError,
2222
AstroidImportError,
@@ -391,13 +391,18 @@ def test_denied_modules_raise(self) -> None:
391391

392392

393393
class IsolatedAstroidManagerTest(unittest.TestCase):
394+
@pytest.mark.skipif(PY312_PLUS, reason="distutils was removed in python 3.12")
394395
def test_no_user_warning(self):
396+
"""When Python 3.12 is minimum, this test will no longer provide value."""
395397
mgr = manager.AstroidManager()
396398
self.addCleanup(mgr.clear_cache)
397399
with warnings.catch_warnings():
398400
warnings.filterwarnings("error", category=UserWarning)
399401
mgr.ast_from_module_name("setuptools")
400-
mgr.ast_from_module_name("pip")
402+
try:
403+
mgr.ast_from_module_name("pip")
404+
except astroid.AstroidImportError:
405+
pytest.skip("pip is not installed")
401406

402407

403408
class BorgAstroidManagerTC(unittest.TestCase):

0 commit comments

Comments
 (0)