summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-04-13 14:42:25 (GMT)
committerGitHub <noreply@github.com>2022-04-13 14:42:25 (GMT)
commit63a032270eba726d36a67e6a33a87284d50e2658 (patch)
tree091d1c779298c6eccc0634320dbec8b06a6363f3 /Lib
parent37a53fb6bd36964d97faad628d16db0b2b62704c (diff)
downloadcpython-63a032270eba726d36a67e6a33a87284d50e2658.zip
cpython-63a032270eba726d36a67e6a33a87284d50e2658.tar.gz
cpython-63a032270eba726d36a67e6a33a87284d50e2658.tar.bz2
gh-90971: suppress deprecation warning in `test_lib2to3`(GH-31464)
Fixes GH-90971 Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Éric <merwok@netwok.org>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lib2to3/tests/__init__.py5
-rw-r--r--Lib/lib2to3/tests/test_parser.py4
2 files changed, 5 insertions, 4 deletions
diff --git a/Lib/lib2to3/tests/__init__.py b/Lib/lib2to3/tests/__init__.py
index 54221c7..f323c23 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 74a5787..e2dddbe 100644
--- a/Lib/lib2to3/tests/test_parser.py
+++ b/Lib/lib2to3/tests/test_parser.py
@@ -92,10 +92,8 @@ class TestPgen2Caching(support.TestCase):
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))