[Python-checkins] [3.11] GH-93481: Suppress expected deprecation warning in test_pyclbr (GH-93483) (GH-93601)

iritkatriel webhook-mailer at python.org
Wed Jun 8 11:16:56 EDT 2022


https://github.com/python/cpython/commit/ce07de9059866d46f112046e1d784ac3a5e2c897
commit: ce07de9059866d46f112046e1d784ac3a5e2c897
branch: 3.11
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2022-06-08T16:16:46+01:00
summary:

[3.11] GH-93481: Suppress expected deprecation warning in test_pyclbr (GH-93483) (GH-93601)

(cherry picked from commit f8eae6f5c35e9def07a732f6bc7744aae106f9b2)

Co-authored-by: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>

files:
M Lib/test/test_pyclbr.py

diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index ad7b31aef1ddd..b2de4e8397d6a 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -9,6 +9,7 @@
 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 @@ def test_others(self):
 
         # 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



More information about the Python-checkins mailing list