Skip to content

Commit b2a5822

Browse files
Filter warnings for the test for old namespace package based on pkg_resource
It won't work when the package is removed but let's keep it for now
1 parent 38fc387 commit b2a5822

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/test_manager.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,15 @@ def test_ast_from_namespace_pkg_resources(self) -> None:
120120
def test_identify_old_namespace_package_protocol(self) -> None:
121121
# Like the above cases, this package follows the old namespace package protocol
122122
# astroid currently assumes such packages are in sys.modules, so import it
123-
# pylint: disable-next=import-outside-toplevel
124-
import tests.testdata.python3.data.path_pkg_resources_1.package.foo as _ # noqa
123+
with warnings.catch_warnings():
124+
warnings.filterwarnings(
125+
"ignore",
126+
category=UserWarning,
127+
message=".*pkg_resources is deprecated.*",
128+
)
129+
130+
# pylint: disable-next=import-outside-toplevel
131+
import tests.testdata.python3.data.path_pkg_resources_1.package.foo as _ # noqa
125132

126133
self.assertTrue(
127134
util.is_namespace("tests.testdata.python3.data.path_pkg_resources_1")

0 commit comments

Comments
 (0)