diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2023-04-16 15:11:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-16 21:11:13 +0200 |
commit | 6723e635e54e991a4304e45293308f5076b0bcb8 (patch) | |
tree | a5e23818b8b22b6ea9bb40edd92875400ce1bd4c /tests | |
parent | 5869ee3ad40f4786be63294d9a0496af4ca1e886 (diff) | |
download | astroid-git-6723e635e54e991a4304e45293308f5076b0bcb8.tar.gz |
Suppress UserWarning when finding module specs (#2121)
Found when linting this code:
```
import setuptools
import pip
```
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_manager.py | 10 |
1 files changed, 10 insertions, 0 deletions
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 |