[Python-checkins] bpo-43844: Fix PendingDeprecationWarning in test_lib2to3 (GH-25407)
vstinner
webhook-mailer at python.org
Fri Apr 16 05:27:06 EDT 2021
https://github.com/python/cpython/commit/471870fc504b0d69c767b188f180b17248be6998
commit: 471870fc504b0d69c767b188f180b17248be6998
branch: master
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-04-16T11:27:00+02:00
summary:
bpo-43844: Fix PendingDeprecationWarning in test_lib2to3 (GH-25407)
files:
M Lib/lib2to3/tests/test_parser.py
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py
index d5db66b9b1e7b..1aba0e88945a4 100644
--- a/Lib/lib2to3/tests/test_parser.py
+++ b/Lib/lib2to3/tests/test_parser.py
@@ -84,12 +84,16 @@ def test_load_grammar_from_subprocess(self):
# 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, \
More information about the Python-checkins
mailing list