diff options
author | Victor Stinner <vstinner@python.org> | 2021-04-16 09:27:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 09:27:00 (GMT) |
commit | 471870fc504b0d69c767b188f180b17248be6998 (patch) | |
tree | d26de5d011dfe58dec659ea4f11416a666d8b2d9 /Lib/lib2to3 | |
parent | 69ca32e0d34fe17dd242592b6f8754cda7bae684 (diff) | |
download | cpython-471870fc504b0d69c767b188f180b17248be6998.zip cpython-471870fc504b0d69c767b188f180b17248be6998.tar.gz cpython-471870fc504b0d69c767b188f180b17248be6998.tar.bz2 |
bpo-43844: Fix PendingDeprecationWarning in test_lib2to3 (GH-25407)
Diffstat (limited to 'Lib/lib2to3')
-rw-r--r-- | Lib/lib2to3/tests/test_parser.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py index d5db66b..1aba0e8 100644 --- a/Lib/lib2to3/tests/test_parser.py +++ b/Lib/lib2to3/tests/test_parser.py @@ -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, \ |