]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-90971: suppress deprecation warning in `test_lib2to3`(GH-31464)
authorNikita Sobolev <mail@sobolevn.me>
Wed, 13 Apr 2022 14:42:25 +0000 (17:42 +0300)
committerGitHub <noreply@github.com>
Wed, 13 Apr 2022 14:42:25 +0000 (07:42 -0700)
Fixes GH-90971

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Lib/lib2to3/tests/__init__.py
Lib/lib2to3/tests/test_parser.py

index 54221c7994386af97ecdbfc732fe1afdf6568d97..f323c2355b2287f58ccd7e0bb55687d642895974 100644 (file)
@@ -1,8 +1,11 @@
 # Author: Collin Winter
 
 import os
+import warnings
 
 from test.support import load_package_tests
 
 def load_tests(*args):
-    return load_package_tests(os.path.dirname(__file__), *args)
+    with warnings.catch_warnings():
+        warnings.filterwarnings('ignore', category=DeprecationWarning, message='lib2to3')
+        return load_package_tests(os.path.dirname(__file__), *args)
index 74a578757420921eb0cc44df41b36bcbf2a7ebea..e2dddbec577c02570dc3014e9e832e23a8d13579 100644 (file)
@@ -92,10 +92,8 @@ class TestPgen2Caching(support.TestCase):
 from lib2to3.pgen2 import driver as pgen2_driver
 pgen2_driver.load_grammar(%r, save=True, force=True)
             """ % (grammar_sub_copy,)
-            msg = ("lib2to3 package is deprecated and may not be able "
-                   "to parse Python 3.10+")
             cmd = [sys.executable,
-                   f'-Wignore:{msg}:PendingDeprecationWarning',
+                   '-Wignore:lib2to3:DeprecationWarning',
                    '-c', code]
             subprocess.check_call( cmd, env=sub_env)
             self.assertTrue(os.path.exists(pickle_sub_name))