summaryrefslogtreecommitdiffstats
path: root/Lib/test/support/warnings_helper.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2022-04-05 19:05:48 (GMT)
committerGitHub <noreply@github.com>2022-04-05 19:05:48 (GMT)
commitc1d93b6411f975d67e43942f1a2745a22983c18c (patch)
treecccdd369da191fa03268967013d60369ab48fcdf /Lib/test/support/warnings_helper.py
parent944f09adfcc59f54432ac2947cf95f3465d90e1e (diff)
downloadcpython-c1d93b6411f975d67e43942f1a2745a22983c18c.zip
cpython-c1d93b6411f975d67e43942f1a2745a22983c18c.tar.gz
cpython-c1d93b6411f975d67e43942f1a2745a22983c18c.tar.bz2
bpo-47061: deprecate the `aifc` module (GH-32134)
Co-authored-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Lib/test/support/warnings_helper.py')
-rw-r--r--Lib/test/support/warnings_helper.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/support/warnings_helper.py b/Lib/test/support/warnings_helper.py
index a024fbe..28e96f88 100644
--- a/Lib/test/support/warnings_helper.py
+++ b/Lib/test/support/warnings_helper.py
@@ -1,10 +1,18 @@
import contextlib
import functools
+import importlib
import re
import sys
import warnings
+def import_deprecated(name):
+ """Import *name* while suppressing DeprecationWarning."""
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', category=DeprecationWarning)
+ return importlib.import_module(name)
+
+
def check_syntax_warning(testcase, statement, errtext='',
*, lineno=1, offset=None):
# Test also that a warning is emitted only once.