aports/community/py3-astroid/disable-pkg_resource_deprecation-warn.patch
2025-07-13 23:48:55 +02:00

36 lines
1.6 KiB
Diff

Patch-Source: https://github.com/pylint-dev/astroid/commit/b2a5822f437639d03047a8348960f64a9d04232e
---
From b2a5822f437639d03047a8348960f64a9d04232e Mon Sep 17 00:00:00 2001
From: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Date: Fri, 27 Jun 2025 09:35:38 +0200
Subject: [PATCH] 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
---
tests/test_manager.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/test_manager.py b/tests/test_manager.py
index 9a7bbdb7ef..6a0f791686 100644
--- a/tests/test_manager.py
+++ b/tests/test_manager.py
@@ -120,8 +120,15 @@ def test_ast_from_namespace_pkg_resources(self) -> None:
def test_identify_old_namespace_package_protocol(self) -> None:
# Like the above cases, this package follows the old namespace package protocol
# astroid currently assumes such packages are in sys.modules, so import it
- # pylint: disable-next=import-outside-toplevel
- import tests.testdata.python3.data.path_pkg_resources_1.package.foo as _ # noqa
+ with warnings.catch_warnings():
+ warnings.filterwarnings(
+ "ignore",
+ category=UserWarning,
+ message=".*pkg_resources is deprecated.*",
+ )
+
+ # pylint: disable-next=import-outside-toplevel
+ import tests.testdata.python3.data.path_pkg_resources_1.package.foo as _ # noqa
self.assertTrue(
util.is_namespace("tests.testdata.python3.data.path_pkg_resources_1")