Skip to content

Commit

Permalink
Skip test_no_user_warning() without pip (#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls authored Jul 29, 2024
1 parent 3585f76 commit 3bcf5ec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import astroid
from astroid import manager, test_utils
from astroid.const import IS_JYTHON, IS_PYPY
from astroid.const import IS_JYTHON, IS_PYPY, PY312_PLUS
from astroid.exceptions import (
AstroidBuildingError,
AstroidImportError,
Expand Down Expand Up @@ -391,13 +391,18 @@ def test_denied_modules_raise(self) -> None:


class IsolatedAstroidManagerTest(unittest.TestCase):
@pytest.mark.skipif(PY312_PLUS, reason="distutils was removed in python 3.12")
def test_no_user_warning(self):
"""When Python 3.12 is minimum, this test will no longer provide value."""
mgr = manager.AstroidManager()
self.addCleanup(mgr.clear_cache)
with warnings.catch_warnings():
warnings.filterwarnings("error", category=UserWarning)
mgr.ast_from_module_name("setuptools")
mgr.ast_from_module_name("pip")
try:
mgr.ast_from_module_name("pip")
except astroid.AstroidImportError:
pytest.skip("pip is not installed")


class BorgAstroidManagerTC(unittest.TestCase):
Expand Down

0 comments on commit 3bcf5ec

Please sign in to comment.