From 6723e635e54e991a4304e45293308f5076b0bcb8 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sun, 16 Apr 2023 15:11:13 -0400 Subject: Suppress UserWarning when finding module specs (#2121) Found when linting this code: ``` import setuptools import pip ``` --- tests/test_manager.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/test_manager.py b/tests/test_manager.py index 16f1be80..4f76d09c 100644 --- a/tests/test_manager.py +++ b/tests/test_manager.py @@ -7,6 +7,7 @@ import site import sys import time import unittest +import warnings from collections.abc import Iterator from contextlib import contextmanager from unittest import mock @@ -383,6 +384,15 @@ class AstroidManagerTest( self.manager.ast_from_module_name(None) +class IsolatedAstroidManagerTest(resources.AstroidCacheSetupMixin, unittest.TestCase): + def test_no_user_warning(self): + mgr = manager.AstroidManager() + with warnings.catch_warnings(): + warnings.filterwarnings("error", category=UserWarning) + mgr.ast_from_module_name("setuptools") + mgr.ast_from_module_name("pip") + + class BorgAstroidManagerTC(unittest.TestCase): def test_borg(self) -> None: """Test that the AstroidManager is really a borg, i.e. that two different -- cgit v1.2.1