summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-04-16 19:27:26 +0000
committerGitHub <noreply@github.com>2023-04-16 19:27:26 +0000
commita4a610490836e79babc0675f8f4763497e85b5d3 (patch)
treed6ac232399d018e155a4e80043718e7863655c58 /tests
parentb65f1917b17f8ad3d720288a70ec40f86a3b0057 (diff)
downloadastroid-git-a4a610490836e79babc0675f8f4763497e85b5d3.tar.gz
Suppress UserWarning when finding module specs (#2121) (#2122)
Found when linting this code: ``` import setuptools import pip ``` (cherry picked from commit 6723e635e54e991a4304e45293308f5076b0bcb8) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_manager.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_manager.py b/tests/test_manager.py
index 9b9b24fe..19efc730 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