]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-93481: Suppress expected deprecation warning in test_pyclbr (GH-93483)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Tue, 7 Jun 2022 20:35:11 +0000 (21:35 +0100)
committerGitHub <noreply@github.com>
Tue, 7 Jun 2022 20:35:11 +0000 (21:35 +0100)
Lib/test/test_pyclbr.py

index ad7b31aef1ddd1f68480c534b367145035b4adc1..b2de4e8397d6ad4ed9272bb72c26e060f0d6f220 100644 (file)
@@ -9,6 +9,7 @@ from types import FunctionType, MethodType, BuiltinFunctionType
 import pyclbr
 from unittest import TestCase, main as unittest_main
 from test.test_importlib import util as test_importlib_util
+import warnings
 
 
 StaticMethodType = type(staticmethod(lambda: None))
@@ -218,9 +219,13 @@ class PyclbrTest(TestCase):
 
         # These were once some of the longest modules.
         cm('random', ignore=('Random',))  # from _random import Random as CoreGenerator
-        cm('cgi', ignore=('log',))      # set with = in module
+        with warnings.catch_warnings():
+            warnings.simplefilter('ignore', DeprecationWarning)
+            cm('cgi', ignore=('log',))      # set with = in module
         cm('pickle', ignore=('partial', 'PickleBuffer'))
-        cm('sre_parse', ignore=('dump', 'groups', 'pos')) # from sre_constants import *; property
+        with warnings.catch_warnings():
+            warnings.simplefilter('ignore', DeprecationWarning)
+            cm('sre_parse', ignore=('dump', 'groups', 'pos')) # from sre_constants import *; property
         cm(
             'pdb',
             # pyclbr does not handle elegantly `typing` or properties