]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43844: Fix PendingDeprecationWarning in test_lib2to3 (GH-25407)
authorVictor Stinner <vstinner@python.org>
Fri, 16 Apr 2021 09:27:00 +0000 (11:27 +0200)
committerGitHub <noreply@github.com>
Fri, 16 Apr 2021 09:27:00 +0000 (11:27 +0200)
Lib/lib2to3/tests/test_parser.py

index d5db66b9b1e7b9a5c0961befe82bfc043dec78e1..1aba0e88945a404119c1766219fe53196b156ea7 100644 (file)
@@ -84,12 +84,16 @@ class TestPgen2Caching(support.TestCase):
             # different hash randomization seed.
             sub_env = dict(os.environ)
             sub_env['PYTHONHASHSEED'] = 'random'
-            subprocess.check_call(
-                    [sys.executable, '-c', """
+            code = """
 from lib2to3.pgen2 import driver as pgen2_driver
 pgen2_driver.load_grammar(%r, save=True, force=True)
-                    """ % (grammar_sub_copy,)],
-                    env=sub_env)
+            """ % (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',
+                   '-c', code]
+            subprocess.check_call( cmd, env=sub_env)
             self.assertTrue(os.path.exists(pickle_sub_name))
 
             with open(pickle_name, 'rb') as pickle_f_1, \