Skip to content

Commit 63a0322

Browse files
sobolevnJelleZijlstramerwok
authored
gh-90971: suppress deprecation warning in test_lib2to3(GH-31464)
Fixes GH-90971 Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: Éric <[email protected]>
1 parent 37a53fb commit 63a0322

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Lib/lib2to3/tests/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Author: Collin Winter
22

33
import os
4+
import warnings
45

56
from test.support import load_package_tests
67

78
def load_tests(*args):
8-
return load_package_tests(os.path.dirname(__file__), *args)
9+
with warnings.catch_warnings():
10+
warnings.filterwarnings('ignore', category=DeprecationWarning, message='lib2to3')
11+
return load_package_tests(os.path.dirname(__file__), *args)

Lib/lib2to3/tests/test_parser.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ def test_load_grammar_from_subprocess(self):
9292
from lib2to3.pgen2 import driver as pgen2_driver
9393
pgen2_driver.load_grammar(%r, save=True, force=True)
9494
""" % (grammar_sub_copy,)
95-
msg = ("lib2to3 package is deprecated and may not be able "
96-
"to parse Python 3.10+")
9795
cmd = [sys.executable,
98-
f'-Wignore:{msg}:PendingDeprecationWarning',
96+
'-Wignore:lib2to3:DeprecationWarning',
9997
'-c', code]
10098
subprocess.check_call( cmd, env=sub_env)
10199
self.assertTrue(os.path.exists(pickle_sub_name))

0 commit comments

Comments
 (0)