diff --git a/Lib/lib2to3/tests/__init__.py b/Lib/lib2to3/tests/__init__.py index 54221c7994386a..f323c2355b2287 100644 --- a/Lib/lib2to3/tests/__init__.py +++ b/Lib/lib2to3/tests/__init__.py @@ -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) diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py index 74a57875742092..e2dddbec577c02 100644 --- a/Lib/lib2to3/tests/test_parser.py +++ b/Lib/lib2to3/tests/test_parser.py @@ -92,10 +92,8 @@ def test_load_grammar_from_subprocess(self): 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))