Skip to content

Commit 6094e8b

Browse files
fixup
1 parent 167c33d commit 6094e8b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

astroid/interpreter/_import/spec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ def find_module(
148148
)
149149
else:
150150
try:
151-
with warnings.catch_warnings(action="ignore"):
151+
with warnings.catch_warnings():
152+
warnings.filterwarnings("ignore", category=UserWarning)
152153
spec = importlib.util.find_spec(modname)
153154
if (
154155
spec

tests/test_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ def test_raises_exception_for_empty_modname(self) -> None:
387387
class IsolatedAstroidManagerTest(resources.AstroidCacheSetupMixin, unittest.TestCase):
388388
def test_no_user_warning(self):
389389
mgr = manager.AstroidManager()
390-
with warnings.catch_warnings(action="error"):
390+
with warnings.catch_warnings():
391+
warnings.filterwarnings("error", category=UserWarning)
391392
mgr.ast_from_module_name("setuptools")
392393
mgr.ast_from_module_name("pip")
393394

0 commit comments

Comments
 (0)